#clojure logs

2012-12-30

00:10bbloomdoes anybody else get a little high whenever some system you've made gracefully handles a new use case you hadn't considered?
00:16ynnivit's a good feeling
00:21bbloomi had a whole big function i was writing to handle the case, stopped to think, glanced at another piece of code, and then added a single keyword to a set somewhere and deleted the whole big function
00:21bbloompoof worked
00:21bbloomi giggled with glee.
00:29technomancyadjusted clojure-doc.org's Emacs tutorial to use nrepl.el instead of slime; any comments before I pull request? https://github.com/technomancy/cds/blob/no-slime/articles/tutorials/emacs.md
00:30bbloomtechnomancy: ok, so what's going on here? clojure-doc.org is dead, yes? and now who owns/operates clojure-doc.org? just you?
00:30technomancybbloom: clojuredocs.org is ... hibernating
00:31bbloomtechnomancy: and written in ruby, FOR SHAME
00:31technomancywell
00:31technomancythere's a Clojure REST API for it too
00:31technomancybut no HTML UI
00:31technomancyyes
00:31technomancyyet
00:31bbloomheh, i don't care :-P
00:31technomancyanyway, clojure-doc.org is completely different
00:31technomancyit's a collection of static tutorials
00:32bbloombut confusingly similar in name....
00:32technomancythe idea is hopefully they can merge once the clojure rewrite of clojuredocs.org is done
00:32bbloomis such a rewrite in progress?
00:32clojurebotTitim gan éirí ort.
00:33technomancybbloom: no one has volunteered to do the HTML UI yet, but the API is done AFAIK
00:33bbloomah ok cool
00:33technomancybbloom: `lein repl` uses it
00:33technomancy(cdoc reduce)
00:33technomancyI think it's the same database behind the scenes
00:33tomojRaynes: you fixed my class= problem just at the right time. but btw, you mispelled 'adjacent'
00:34Raynestomoj: Oh, damn! Nice catch.
00:34technomancybbloom: oh, looks like it got moved to (user/clojuredocs reduce)
00:34Raynestomoj: Yeah, I just noticed the class= issue a moment ago.
00:34Raynestomoj: I'm making a few other changes and then I'll release 0.1.12.
00:34bbloomtechnomancy: both worked for me
00:34RaynesShould be just a few minutes.
00:34tomoj:D
00:34bbloomok neat, didn't know this existed
00:34technomancybbloom: it's a thing!
00:35technomancyand you don't have to feel guilty about using rails
00:35bbloomheh
00:35Raynestomoj: Other significant change is that I'm renaming select-and and select-or to and and or, since people should never be :refer :alling this library anyways.
00:35bbloomi don't feel guilty. for all the horrible evil things in rails, it did exactly what it's good for: clojuredoc.org existed at all
00:35bbloomb/c it got built fast
00:35bbloomb/c rails is easy
00:35Raynes(I already shadow clojure.core/remove, so I figured I might as well do this too)
00:35technomancybbloom: well
00:35technomancynot really
00:35technomancyit was never OSSed
00:35bbloombut clojure is mature enough, it's time to not suck
00:36technomancyand if clojuredocs.org was never released, someone else would have written something
00:36tomojRaynes: thanks!
00:36tomojI was miffed that I couldn't :require :as lz :rename {select-and and} to get lz/and
00:37technomancyif the existing site hadn't been created we probably would have something community driven and wouldn't be stuck with a single maintainer going MIA
00:37tomojlooks like there's a phantom descendant-of floating above the real one, dunno if you know
00:37bbloomtechnomancy: fair enough
00:37tomojnot that it would matter
00:37Raynestomoj: Yeah, I've been trying to use laser to rewrite random enlive code that I see so that I can catch annoying little things like this
00:37bbloomtechnomancy: as long as it's getting fixed
00:38technomancyslowly but surely
00:38marcelusbetter documentation site in the works?
00:38Raynestomoj: Grrr, fixed. Also fixed the ajacent typo.
00:39RaynesTIL I can't spell adjacent.
00:39technomancymarcelus: clojure-doc.org has been around a while
00:40tomojany nice way to select with a regex against attr values? could write attr-matches, but that seems too specific. maybe attr-pred, but seems like even that could maybe be broken down?
00:40Raynestomoj: It also just occurred to me that I should probably make some other selectors be like descendant-of and take arbitrary arguments (I think it would make sense in child-of and adjacent-to), but I'll save that for the next version so that I can get the class= fix out for you.
00:41tomojwell, I'm fine using checkouts, fwiw
00:41TimMcgfredericks: Well, I'm enjoying it. It's pretty readable, and I think just the first couple chapters are worth reading on their own.
00:41marcelusSo umm is there an unwritten rule that says we shall choose eerily similar names for things. :P
00:41technomancyspeaking of HTML UIs, clojuredocs.org would be a great splash for introducing laser to the world
00:41technomancymarcelus: see above; the long-term plan is to merge the two
00:41marcelusoh I read that. I'm just messing with ya. :P
00:41abaranoskyanywhere I can read more about plans for clojuredocs.org?
00:42Raynestomoj: You want a selector that is like attr=, but matches with a regex rather than just a plain string?
00:42technomancyabaranosky: talking to dakrone, antares, and uvtc is your best bet
00:42Raynestechnomancy: You trying to get me to write a documentation site? ;)
00:42abaranoskyit is pretty nice, but stuck on 1.3 still
00:42tomojyeah, not in laser probably. but thinking maybe its building blocks could be useful in laser
00:42RaynesI was actually considering it when I have a bit of free time.
00:43technomancyRaynes: just a UI for an existing site =)
00:44bbloommarcelus: all of the good names are taken, thus all names are earily similar
00:44Raynestomoj: Isn't it just (defn re-attr [attr re] (re-find re (get-in (zip/node loc) [:attrs attr]))
00:45bbloomhence why the unix people just gave up and invented words
00:45RaynesEr
00:45Raynestomoj: Isn't it just (defn re-attr [attr re] (fn [loc] (re-find re (get-in (zip/node loc) [:attrs attr])))
00:45marcelusSo that's what it is!
00:46tomojyeah, but what if I want to regex match against classes now?
00:46tomojI'll try saying what I mean in code sometime
00:46RaynesClasses is an attribute too. :p
00:46tomojah.. heh
00:46Raynesclass= and id= are just convenience things, really. Especially id=.
00:47tomojI like convenience :)
00:47jlewisi wrote a union-find implementation for clojure that i'd like to submit to the mailing list in a bit. but first i was wondering if any kind soul was interested in giving me some comments :)
00:47jlewishttps://github.com/jordanlewis/data.union-find
00:47RaynesI could make the existing attr= take either a regex OR a string.
00:47tomojI wouldn't vote for that, but you're the dictator
00:48RaynesI'm not usually a fan of that sort of thing either.
00:48marcelusI wonder if clojurescript will end up making google closure itself more popular. Well at least after someone puts together nicer docs for clojurescript (Though Closure's docs could be a bit easier to navigate too.)
00:50marcelusEven though I had to bang my head against a wall for a day or two trying to figure out what was going wrong with my ajax request I see alot of potential here for something really nice. Even for plain old websites that need some events
00:50tomojI'm thinking like (comp (in-attr :href) (partial re-matches #"^/foo/.*"))
00:50tomojer. that doesn't seem quite right. nevermind for now :)
00:50marcelusa nice gateway to clojure proper if you will.
00:51Raynestomoj: Yeah, I'm not sure there is much to generalize.
00:52RaynesSimply because it's so easy to write a function that does what you need if laser doesn't have a selector for it. Like, if you wanted to convert an attribute to an integer and multiply it by 4 and see if it is equal to something (because you're nuts?) (defn be-crazy [n] (fn [loc] (= n (* 4 (Long. (get-in [:attrs :someattr])))))
00:53RaynesThat said, I can add re-attr. It's probably useful for people that aren't you.
00:53RaynesAlso, s/integer/long/
00:54tomojI perhaps irrationally want fewer points
00:55Raynestomoj: Points?
00:55tomojlike 'loc in your example
00:56tomojpoints as in point-free
00:56RaynesOh.
00:56RaynesSounds pretty irrational. :p
00:56bbloomtomoj: #concatenative is that way --->
00:56bbloom(virtually) ZERO POINTS
00:57tomojmaybe that's the way, I don't think it's what I want though
00:57marceluswhat is laser?
00:57tomojI want as much as possible to just read off the type http://conal.net/blog/posts/semantic-editor-combinators
00:57tomojI don't want to keep track of an invisible stack
00:57tomojbut I probably don't understand factor yet
00:58Raynestomoj: It sounds like you want a functor over attributes. :P
00:58tomojyes
00:59tomojor at least I think so right now, need to play around
00:59tufflaxI'm trying to use test-> in clojure 1.5.0-RC1, but it doesn't seem to work. Isn't there supposed to be a test->?
00:59tomojmarcelus: https://github.com/Raynes/laser/
00:59Raynestomoj: I'm going to leave things as they are for now. If you come up with any ideas, let me know (issue, pull request, IRC).
01:00Raynestomoj: I've got to take off, but if you're really okay with using checkouts for tonight, I'll hold off on this release until I can consolidate adjacent-to and child-of with descendants-of.
01:00tomojsure, no prob
01:00RaynesI'll have that done tomorrow though.
01:00tomojI'd probably switch to a checkout soon anyway
01:01RaynesThanks for pointing out the adjacent-to typo. If a certain guy named Alan had noticed it first, I'd never hear the end of it.
01:02Raynestomoj: Don't think I ever asked what you were doing with laser. TELL MEH
01:02RaynesBefore I go.
01:03tomojuh, just screen scraping dominiondeck.com
01:03RaynesNice. I only added 'select' like a day ago.
01:04RaynesAlso, you and I have to play together some time. I like Dominion.
01:04ClojureNewbI'd like to perform function f over each item in a vector and pass an arg, like this;
01:04ClojureNewb(def a [1 2 3 4 5])
01:04ClojureNewb(def m {:k "mydata"})
01:05ClojureNewb(do-stuff (second a) (do-stuff (first a) m)) etc...
01:05ClojureNewbPlease help!
01:05Raynes(map #(f % m) a)
01:05tomojwould (do-stuff (do-stuff m (first a)) (second a)) work
01:05RaynesOr… I guess not.
01:06RaynesI got all excited about map when I read the first message.
01:06ClojureNewb'a' is a variable length vector
01:06RaynesDream killer.
01:06tomojthat's (reduce do-stuff m a) I believe
01:06ClojureNewbI'll think about reduce - I'll have to check it. Thanks!
01:06tomojor (reduce (flip do-stuff) m a) if you had your original argument order, and if there was a flip...
01:07technomancyhokay
01:07technomancyclojure-mode and clojure-test-mode 2.0 are out
01:07technomancythe switch to nrepl is complete
01:08tomojhmm.. I suppose us swank holdouts should take another look?
01:08technomancytomoj: depends why you've been holding out I guess =)
01:08technomancythere is still no inspector =(
01:09tomojoh well. it's probably time
01:09bbloomwhat's the inspector do?
01:09bbloom(besides, you know, inspect)
01:10tomojit shows you all the java method signatures for a class/instance
01:10technomancybbloom: hyperlinked jumping around a layout of a class's interfaces, constructors, and methods
01:10tomojamong other things
01:10tomojthe hyperlinks always throw exceptions for me :(
01:10technomancybasically makes javadoc unnecessary
01:10technomancy(unless you need argument names)
01:11bbloomtechnomancy: javadoc is always unecessary.
01:11technomancyI think clojure.reflect does a lot of what the inspector does
01:11technomancybut the slime inspector is a much better interface for the functionality
01:11marcelustechnomancy: is there any chance of getting the font-lock to work better for things like (foo/bar) so that it gets highlighted like in github?
01:11bbloomah ok
01:12technomancymarcelus: "better"?
01:13technomancyyou mean coloring referred vars the same as built-ins?
01:13marcelusyes
01:14technomancyhmmm... I probably wouldn't add it myself, but I could take a pull request for it
01:14technomancytoo bad you just missed the release of 2.0.0
01:14technomancyby like ten minutes
01:14marcelusits not a big deal but it would be nice to have just the same
01:14marceluslol
01:14marcelusis it already available though package.el?
01:14bbloommarcelus: i actually quite like in the vim highlighting that builtins get highlighted differently than my own things
01:15technomancyyeah in marmalade
01:15technomancybbloom: I can see the appeal in differentiating between vars that come from the file vs vars that are refered
01:15technomancyand TBH treating clojure.core as special rubs me the wrong way
01:15technomancybeyond the obvious fact that it's auto-refered
01:15technomancy*referred
01:15tomojI don't like the specialness either
01:16tomojthe only time I notice it is when something is a weird color for no good reason
01:16bbloomcore being special is a good stop gap
01:16bbloomit's better than all vars being highlighted regardless of refer status
01:16marcelustrue
01:17marcelusbbloom: that does make sense I never really thought of it like that
01:17tomojlike why is the "select" in 'lz/select green?
01:17technomancyit might be interesting to tie into nrepl so you could distinguish between vars that come from your project vs 3rd-party libs
01:17technomancytomoj: =\
01:17technomancyit goes overboard with that by adding stuff for clojure.set, clojure.zip, etc
01:17technomancyprobably should have revisited that before cutting 2.0.0 OH WELL
01:18tomojeh, I don't really care anyway :)
01:18bbloom2.1.0 !!
01:18bbloom(says the vim user
01:18bbloom)
01:18technomancyoff by 15 minutes
01:18tomojglad to just see movement on those modes
01:18technomancywhoa; last clojure-mode release was 12 dec 2011
01:21marceluswonder why marmalade doesnt load up but melpa does
01:22marceluseven after reevaluating the package-archives variable
01:22marcelusnvm
01:23marcelushad to re load the buffer
01:27dcbbbloom: this is directed at you because you mentioned using vim, but really this is for any vim user: what is the current state of vim with clojure? I'm using the VimClojure plugin as well as lein-tarsier, and its OK, but I feel like I could be missing something
01:28bbloomdcb: https://github.com/tpope/vim-foreplay
01:28marcelusyea org-mode and erc :P
01:28bbloomif i do any more advertising, tpope is gonna owe me royalties
01:28tpopeif you do any less, I'll start charging you for foreplay.vim :D
01:29dcbbbloom: hah. Is this a replacement for VimClojure (not sure if you have experience with that)?
01:29tpopeit replaces the dynamic portion
01:29tpopei.e., it does not provide basics like syntax highlighting or indenting
01:31dcbtpope: Awesome, I'm definitely going to check it out, I think it will fit right in beside the 10 other plugins I'm using that you authored :). Thanks for all of your awesome work!
01:31tpopecheers
01:52tufflaxIs futures lazy? If I don't deref my future it seems it does not happen. But if I deref it my thread will wait for it, which is what I wanted to avoid in the first place.
01:52tufflaxWhat I'm trying to do is play a sound, but not have to wait for it. What should I do?
01:53tomojtry &(do (future (println "foo")) nil)
01:53tomojlazybot won't do future for some reason
01:54tufflaxk
01:54tomojthat shows that it is not lazy in the sense I think you mean
01:55tomojare you running a program which calls future to play a sound and then exits?
01:55tufflaxno
01:55tufflaxMy program loops in a loop, waiting for user input
01:55tomojI'd just stick a (do (println "called!") ...) around the thing that triggers the sound
02:00tomojit doesn't print if you don't deref?@
02:02dcbtomoj: I think futures are dissallowed by clojail. Raynes would know
02:02tomojyeah, he's gone
02:02tomojsupposedly :)
02:02dcbtomoj: hehe
02:03tufflaxtomoj, yes it prints, but no sound ;( and what's even more strange, is that when I quit my main loop, my propram does not terminate if i have spawned a future
02:04tufflaxat least i find that strange :P
02:04tomojI wonder if it has something to do with the repl env, have you tried with `lein run`?
02:04ToxicFrogSo do I.
02:05tomoj`lein trampoline run` I guess
02:05tomojfuture-call uses the agent solo executor
02:05tufflaxI'm using lein trampoline run
02:05tomojso you probably need to call (shutdown-agents) after you quit your main loop
02:06tufflax@(future (-> in Player. .play)) plays a sound, but not @(future (do (println "called") (-> in Player. .play)))
02:07tufflaxisn't that wierd?
02:07tomoj... yes
02:07tomoj@(future (-> in Player. .play when)), no sound?
02:08tufflaxwhat's when?
02:08tomoj(doc when)
02:08clojurebot"([test & body]); Evaluates test. If logical true, evaluates body in an implicit do."
02:08tufflaxbut, why would i put it there? :P
02:08tomojthat's an abuse of it
02:08tufflaxok ;p
02:08tomojwhat you say doesn't make sense to me
02:08tomojthat's another test
02:09tufflaxwith when it plays the sound
02:09tomojthe body is nil so it's like (do (-> in Player. .play) nil)
02:09tomojhmm
02:09tomojwhy?
02:10clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
02:25tufflaxtomoj, hm I tried @(future (do (println "called") (-> in Player. .play))) and it does play a sound. Maybe I was mistaken before. But anyway, if I don't deref, it prints "called" but does not play a sound. If I put the print after the play, it does not print or play.
02:25tomojtry (future (-> in Player. .play println)), no deref
02:26tomojI dunno what Player or .play are
02:26tomojbut I really dunno
02:27tomojI find it strange too :)
02:27Raynestomoj, dcb: Futures are not allowed by clojail because I can't forcibly kill them like I can normal threads.
02:27tufflaxdoes not work, the last one
02:28tomojah
02:28Raynestomoj, dcb: Technically almost anything that is not allowed could be allowed if we were willing to write sandboxed implementations of them. It's just hard and tedious work.
02:28tomojyeah
02:29tomojcaha + cljs seems interesting
02:29tomojer, caja?
02:29dcbRaynes: interesting. I agree- probably not worth the time
02:35Raynescallen: Heh, I can pick you out of a group of people from a mile away now.
02:36Raynescallen: http://www.reddit.com/r/Clojure/comments/158oyh/first_clojar_created_would_love_feedback/c7kgeik
02:42bbloomRaynes: lol, good catch
02:43Raynestomoj: I think you're the first person besides me using laser. o/
02:43bbloomRaynes: he'll get to bitch about my library soon too, even tho it isn't strictly a templating library
02:43tomojsay you have <div class="group"><div class="group-0">foo</div> <div class="group-1">bar</div></div>
02:43tomojrepeatedly
02:44Raynesbbloom: What library?
02:44tomojer, not repeatedly
02:44bbloomthe scene graph thing i'm working on
02:44RaynesWhat does that have to do with templating? O.o
02:45bbloomRaynes: i now have a partially working port of https://github.com/addyosmani/todomvc/blob/gh-pages/architecture-examples/angularjs/index.html
02:46bbloombut it's a tree of maps rather than html
02:48Raynesbbloom: This is some sort of templating thing where you set an attribute and... uh... I don't follow. :p
02:48Raynestomoj: You had a question in there somewhere, right?
02:48tomojI want to select the text content of select descendants (omitted above) of the #"^group-\d+$" classed nodes, but get the results grouped by the group-\d nodes
02:48RaynesThere we go
02:48Raynes:p
02:49bbloomRaynes: you can ignore the rest of the tutorial, this one page makes the point: http://docs.angularjs.org/tutorial/step_02
02:50RaynesInteresting.
02:50RaynesWe'll fight to the death.
02:50Raynestomoj: That's interesting.
02:51Raynesthinking
02:53Raynestomoj: Does the div classed group contain anything other than those group-id nodes?
02:54tomojhttps://www.refheap.com/paste/79ed442b28bb05fa0dcc04727
02:56Raynestomoj: I can't think of a way that you could do this off the top of my head except matching the container above it and grouping its contents.
02:56tomojhttps://www.refheap.com/paste/11d4e3950cb614b7361db7561
02:57RaynesAlso, ugh, you had to copy half of class. Definitely gotta do something about the regex stuff.
02:57Raynes:p
02:59RaynesRight now, laser just selects each individual node that matches. It can't order them or anything, or group them. A selector can't do that. You could change the select function (which works independantly from the rest of laser) to work different and add some functionality, but I can't think of what I'd add.
02:59tomojyeah, I tried to use fragment
02:59yediis edn gaining any traction?
02:59RaynesWhat would you use fragment for?
03:01tomojI experimentally tried doing this https://www.refheap.com/paste/fa91716fa5ce222e1096dbef5
03:01tomojbut that doesn't work.. where do you get a seq of locs from to pass to fragment?
03:02Raynestomoj: I was thinking (very crude example): (group-by (comp :class :attrs) (l/select (l/class= "group")))
03:03Raynestomoj: I think your fragment call doesn't do anything at all though.
03:03tomojit should be identity, right?
03:03tomojbut it's an error
03:04tomojoh, well
03:04RaynesWell, the transform has to be a function, but your function would just return the html you selected and it would replace it in the HTML and you'd get back the same html you passed in.
03:04tomojof course, cus it's not a seq
03:05Raynesparse-fragment gets what you'd want to pass to fragment.
03:05RaynesBut I don't think you can do what you want with fragment.
03:05tomojah
03:06tomoja transform can't return something other than a hickory node?
03:06RaynesIt can return a seq of hickory nodes or a node.
03:07RaynesIt transforms the html in place and doesn't pull it out.
03:07RaynesDid you see the example I showed above?
03:07RaynesHow much trouble would it be to select the top-level node instead and group its content?
03:08RaynesOr, wait.
03:08RaynesUgh, you had to ask questions at 2AM.
03:08Raynes:p
03:09RaynesI didn't understand your question completely.
03:10RaynesOkay, I get it now.
03:11Raynestomoj: Okay, could you select the group-id nodes instead and then do your grouping?
03:11RaynesSeems like that makes the most sense, because then you have access to the id.
03:11RaynesBut I guess that's a pain in the ass because of the the number of children.
03:14Raynestomoj: Looking at your sample HTML, if you selected the group-id divs, you could get the field-item divs like so: (-> (:content group-id-div) first :content first)
03:15RaynesThis is all admittedly painful, but I can't immediately think of a better solution.
03:15RaynesI doubt you'd be any better off with enlive.
03:21Raynestomoj: Did you die?
03:22tomojhttps://www.refheap.com/paste/a767ffc38094bdff3554e07e2
03:22tomojwith enlive, there's a #'text somewhere that works, iirc
03:22tomojsince it's not hickory
03:23tomojclojure.data.zip.xml/text
03:24tomojline 11 makes me think I'm doing it wrong
03:25Raynestomoj: Oh, you mean how god awful it is to get something out of a node to pass to select?
03:25RaynesYeah, I realized about 30 minutes ago how nasty that would be.
03:26RaynesI need to add a function for doing that.
03:26RaynesIs that what you're talking about, tomoj?
03:27tomojyeah
03:27RaynesYeah, I'll make that better.
03:27ibdknoxtomoj: are you making a dominion game?
03:28tomojI've been working on it some
03:28ibdknoxcool
03:28Raynestomoj: So, you're saying that there is a way to do this in Enlive that doesn't suck?
03:28tomojno
03:28bbloomtomoj: did you see carter-thaxton's ruby one? he had a pretty neat little green thread thing w/ a DSL and whatnot: https://github.com/carter-thaxton/ruby-dominion
03:28RaynesI wasn't sure what you meant by #'text
03:29bbloomtomoj: lib/cards.rb is neat
03:30tomojyeah, I guess it's neat
03:30tomojhttps://www.refheap.com/paste/399c73d12a174759d65d3a923
03:30tomoj558 lines for the base set (of course it's not complete)
03:30Raynestomoj: I've got a list of stuff to do with laser tomorrow. Added making your code easier/smaller to that list.
03:31RaynesThere are several things I can improve there.
03:32ibdknoxbbloom: that's surprisingly well thought out :)
03:32bbloomibdknox: smart dude
03:33Raynestomoj: So, what do you think of laser so far?
03:33RaynesOne thing I'll note is that I'm going to be fixing/improving a bunch of stuff tomorrow, whereas if this were enlive stuff, you'd probably have an issue and a pull request and about 6 months to two years before getting anything actually done. :p
03:34tomoj"My compromise is the following: Peddler.cost always returns 8. However, peddler.cost (where peddler is an instance of Peddler), will return a contextual cost. All cards have a context, which can be a Player or a Game instance."
03:34tomojthat sounds like quite a struggle, maybe I just don't understand :)
03:34ibdknoxcombinations of cards in dominion can be pretty complicated
03:35ibdknoxe.g. bridge substracts the value of all potentially buyable cards
03:35ibdknoxcoupled with something like a throne room
03:35tomojyes
03:35tomojI just mean it sounds like he's struggling with OOP
03:35ibdknoxah
03:35tomojinstead of just separating facts about cards from facts about instances of cards
03:35tomojand using data
03:37tomojbut I guess you have to struggle with OOP if you're in ruby, that doesn't mean the library is not neat
03:38bbloomtomoj: yeah, ruby's DSL approach *looks* like data, but it's really a big ol' mutable bag of oh shit
03:38bbloomall those card attribute declarations are mutation objects at startup
03:38bbloomthe good design principal still applies: separate what from how
03:39ibdknoxI don't think his solution is that far from what I would do in Clojure to be honest
03:39bbloomibdknox: right, you'll just have 98% less unit tests and 200% more confidence :-)
03:40ibdknoxhaha
03:40ibdknoxWhat are unit tests? ;)
03:43ChongLi_what's a good way to manage js libraries in a cljs project?
03:47bbloomman, i really wish i had a way to invert a block of clojure code for bi-directional bindings... i don't need it to work on everything, just the most common stuff people would use in a binding expression
03:48bbloomit's so easy for concatenative languages: http://docs.factorcode.org/content/article-inverse,intro.html
03:49tomojhah
03:50tomojso you write some concatenative stuff that renders the model into, say, hickory (?), then invert it, and you get something that takes hickory and returns an updated model?
03:51bbloomtomoj: i'm thinking i can write a macro that can invert common expressions used in bindings. generally, any expression you're gonna use is gonna be a pretty trivial -> pipeline
03:52bbloom(-> foo :bar (f x))
03:52bbloomthe inverse of a keyword is assoc, or more generally get-in inverts to assoc-in
03:54bbloomreally only needs to work on a tiny subset of expressions, like some of the "filter" things on the left nav of http://docs.angularjs.org/api/
03:54wingythere is this templating lib for css .. anyone knows which one i am talking about?
03:54bbloomie format-currency needs to have an inverse parse-currency
03:54bbloomso that you can write (currency cost) and have it be two-way data bound reasonably
03:57bbloomi'm gonna cheat for now and make it two separate things like this '{:bind foo, :convert [:bar (f x)]}
03:57bbloomthat should be good enough for now
04:10dsantiagoRaynes, you still there?
04:11callenhttps://github.com/rathwell/clj-style
04:11callendsantiago: if it's about laser, I might be able to help. maybe.
04:12dsantiagocallen: I have no idea, he asked if I was around a while ago while I was out.
04:13callendsantiago: just checked my lastlog, you guys are playing IRC tag. He's it now.
04:13dsantiagoWell, he'll never catch me.
04:13callendsantiago: well laser is the main thing he's about lately.
04:19yediis porting code from clojure to cljs nontrivial?
04:19yedidepends on the code right, etc. but generally speaking
04:22tomojwhat do you mean by "generally speaking"? for some code, it's as trivial as `cp foo.clj foo.cljs`. for lots more code, it's not much harder than that. for some code, it's a whole lot harder
05:04Raynesdsantiago: Am now, are you? :p
05:04dsantiagoTurns out yes.
05:04Raynesdsantiago: I just wanted to see if you had noticed https://www.refheap.com/paste/7927
05:05RaynesThere is already a year old issue on jsoup about it, so *shrug*
05:05dsantiagoI hadn't, and there's nothing I can do about it.
05:05RaynesNothing you can do about it, was just curious if it had ever annoyed you.
05:06RaynesNot that big if a deal, really, just weirded me out earlier. I was like omgwtfjsoup
05:07dsantiagoWhat is that supposed to parse to?
05:09Raynesdsantiago: Well, I was expecting that it wouldn't throw away the tags.
05:10Raynes(not hickory, jsoup of course)
05:10dsantiagoI ask because the HTML5 parsing rules sometimes fill in tags that are missing and correct misformating, so I wonder what HTML5 does with TR/TD tags that aren't in a TABLE.
05:12RaynesI don't think this behavior is actually a bug. It just isn't what I want in this case.
05:12Rayneshttps://github.com/jhy/jsoup/issues/135 is the relevant issue. Not sure what jhy thinks of it. He never responded to it.
05:12dsantiagoMy HTML expert friend isn't on so I can't ask him.
05:13Raynesdsantiago: http://stackoverflow.com/questions/7985791/why-jsoup-cannot-select-td-element/7986084#7986084 question by the same guy
05:14RaynesOne answer says that it is indeed invalid HTML (which doesn't matter to neither he nor I), and he 'fixed' it by telling jsoup to (lol) use an xml parser.
05:15dsantiagoYeah.
05:17Raynesdsantiago: http://stackoverflow.com/questions/6722307/use-jsoup-to-parse-xml-prevent-jsoup-from-cleaning-link-tags
05:18RaynesWould it be useful to be able to tell hickory what parser to use?
05:18RaynesProbably not.
05:18dsantiagoYou already can.
05:19dsantiagoIf you get jsoup to parse you some HTML and give you a DOM tree, the as-hiccup/hickory functions should work on wahtever it gives you.
05:19dsantiagoparse and parse-fragment are just conveniences.
05:19RaynesAh, gotcha
05:21Raynesdsantiago: Actually, it looks like the xml parser might actually do what I want. It just doesn't enforce valid html, but I'm not a browser so it kinda works.
05:21RaynesI'll play with that tomorrow.
05:21Rayneshttp://jsoup.org/news/release-1.6.2
05:21dsantiagoYeah, you're kinda gonna be unhappy either way.
05:22dsantiagoThere's all sorts of things that are valid HTML but not XML. If you want to parse any HTML into a useful data structure, you need a parser that can handle that. XML-type parsing won't be able to.
05:25callendsantiago: do you use magit?
05:25dsantiagocallen: I don't.
05:25callendsantiago: your loss. >:)
05:26callendsantiago: any interest in web dev?
05:26dsantiagoPretty interestedi n that.
05:27borkdudethe problem list on 4clojure.com isnt't fully available on github?
05:27Raynesborkdude: The problem list is in the database alone.
05:27callendsantiago: http://www.luminusweb.net/ Also, I've been pondering a wiki for Clojure like EmacsWiki.
05:27borkdudeRaynes I see
05:28callendsantiago: I expected it to be a fairly popular idea, but surprisingly, it wasn't. I've found it very difficult to determine "best practice" in Clojure even though the documentation is readily available. I was musing to myself that a wiki might help. Especially a well-done one. Any thoughts there?
05:28Raynesborkdude: I saw your enlive question on stackoverflow. I rewrote your example with laser (for fun) and found a few things that I improved, so thanks for asking Enlive questions. :p
05:28Raynesborkdude: I'm on Windows and don't have access to it, but I'll tweet you a link to the laser version tomorrow.
05:28callenRaynes: that's a really exceptional idea for improving laser.
05:29callenRaynes: for smoothing out the rough edges.
05:29borkdudeRaynes please share your laser version, yeah :)
05:29callenRaynes: could you post a before/after on refheap?
05:29callenI'm quite curious.
05:29Raynescallen: Yeah, I was doing that all night.
05:29Raynescallen: A before after of what? The laser version of his enlive thingy?
05:29dsantiagoI don't really understand the interest I see in many parts in being able to go to a site or something that will tell you "the best practices" for various things.
05:29callenRaynes: yes please. on refheap.
05:30callendsantiago: I've seen a lot of questions here about things like swap!
05:30RaynesI don't have the old version, but I can probably reproduce it from memory. Will do callen. Tomorrow.
05:30callendsantiago: AFAICT, most programmers have been burnt too many times by accidentally misusing things in ways the documentation doesn't really cover very well.
05:30callenRaynes: don't perform any free labor on my account, I was just hoping to learn something. Don't bother.
05:31Raynescallen: I'd be interested in seeing it to and it's a simple example.
05:31Raynestoo*
05:31callenRaynes: also what the hell is ibdknox doing that requires 10 different programming languages? is he subcontracting work out?
05:31RaynesOn Light Table?
05:31ibdknoxhm?
05:31clojurebotbenchmarking is https://github.com/hugoduncan/criterium
05:31callenI hadn't specified LT because I wasn't sure it was about LT.
05:31RaynesUnfortunately I do not have a direct line to ibdknox.
05:31callenI was just curious about what was twatted
05:31callenRaynes: oh, it was an exchange between you two. n/m
05:32ibdknoxwhat are we talking about?
05:32callenibdknox: polygot tweet
05:32Raynescallen: That wasn't ibdknox, bro.
05:32callenoh fuck me
05:32RaynesThat was cemerick
05:32Raynes:p
05:32callenthat was cemerick wasn---yes.
05:32callenibdknox: sorry, carry on.
05:32ibdknoxhuh, now I'm curious what he's doing
05:32RaynesYeah, he wants a bunch of example usages of his PDF libraries written and then organized on Github.
05:32ibdknoxah
05:33RaynesIt's simple stuff.
05:33callenRaynes: oh I love stuff like that.
05:33callenRaynes: very cool
05:33RaynesYou can see if he still needs it done.
05:33RaynesHe isn't paying for it, of course.
05:33callenRaynes: my labor is better allocated, I was merely curious.
05:34callenI have 1,001 side projects, only a few of which proffer any path to putting pork on my plate.
05:34RaynesI have similar problems.
05:35ejacksoni've yet to have a side project do that :)
05:35callenRaynes: товариш!
05:35ejacksoni view them as pork, to be paid for by the rest of what i do
05:35callenejackson: you have to seek it out. I'm exceedingly greedy.
05:37ejacksonlife's too short
05:38callenejackson: that's precisely my point, life's too short to let other people control me through a job.
05:38callenejackson: thus, attempts at generating revenue on *my* terms.
05:38ejacksoncallen: oh yeah, 100% on that. I've not had a job in 2 years
05:39ejacksonmarch to my own bugle
05:39ejacksonbut greed, for anything other than my own sparkling company, couldn't justify it
05:39callenejackson: I've bootstrapped before, but it fell apart. I'm trying to make a go of it with the benefit of a great deal more experience.
05:40ejacksonyeah, its a lot harder than i'd expected :)
05:40ibdknoxit's a very difficult balancing act
05:40ejacksoni was hoping to have more time to code, but actually I now have a lot of other malarcky interposing itself
05:41bbloomejackson: yeah, running a company takes a fuckload of time
05:41callentime that has nothing to do with code, or in a lot of cases, even product.
05:41ibdknoxon things that you don't realize actually *do* take time, no less
05:41ejacksoni'm trying to run two ! a consulting company, and a different product company
05:41callenbecause you underestimate the difficulty of everything everybody does that isn't your own specialty
05:41callenstandard cognitive bias.
05:41bbloomibdknox: WHO IS GOING TO ORDER THE COAT RACK!?
05:41ibdknoxejackson: consulting company with employees?
05:42ejacksonibdknox: no, one man band
05:42ibdknoxbbloom: lol
05:42bbloomthat shit adds up
05:42ibdknoxit really does
05:42callenconsulting vs. product is something I've been musing over. I tried asking patio11 in a recent thead, that didn't go anywhere.
05:42ejacksonbbloom: yeah, it turns out somebody has to do all that
05:42ejacksonfor me its all the gladhanding, and chasing potential clients, treating their staff gently etc etc
05:43snowylikewhat does a consultant do, if i may ask?
05:43ejacksonprostitutes any skill he has to the highest bidder
05:43callensnowylike: produce value for businesses via knowledge, skill, experience, w/e
05:44ejacksonusually its some tail skill that a company can't afford, or doesn't need, to have on hand all the time
05:44callensnowylike: usually consulting is economically useful because their time is economically leveraged in ways they couldn't generally access themselves.
05:44ejacksonbut need for some particular project
05:44snowylikeso, like
05:44ibdknoxtruth: no one knows
05:44ibdknox;)
05:44ejacksonibdknox: SSSH dammit !
05:44snowylikeyou can do something they can't, whatever that may be?
05:44ibdknoxsnowylike: more or less, yes
05:45callenif a consultant knows things that could make a business 10% more efficient, if that business has $250mm in yearly revenue vs. a bootstrapped startup, it's usually more directly economically beneficial to consult for the big business and extract value than attempt to bootstrap.
05:45ejacksonyeah: so I build mathsy back-ends for people
05:45callensnowylike: something they need irregularly or can't afford full-time.
05:45callenejackson: oh I have something to discuss with you in private then, if exploring n-dimensional search spaces is of any interest.
05:45snowylikeand how do you get into this consultant business?
05:45callenejackson: it's a "solved" problem, but I haven't found anyone competent enough to do a post-mortem with.
05:46callensnowylike: develop a portfolio, references, a valuable skill, start marketing yourself.
05:46ibdknoxfine point: consultants often don't actually produce a final product - they lay out how you might do that yourself. They provide information and guidance.
05:46callensnowylike: you spend as much time selling yourself as working, ofttimes.
05:46ejacksonmore in the beginning
05:46snowylikein that case i don't think i'd be a good consultant
05:46snowylikenear non-existant marketing skills
05:46ejacksonas the poet laureate said: pimpin' aint easy :p
05:47ibdknoxsrsly
05:50thorwilis it a bug or a feature that korma will return a vector of results even for a select with the primary key?
05:50wingywhy do i keep getting: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class myapp.server__init when requiring a file
05:53bbloomwingy: what is your file name and what is the symbol in the ns form at the top of that file?
05:53ejacksonthorwil: probably a feature to ensure that the interface is consistent
05:54thorwilwhich then leads to me being consistent in taking first of the result :)
05:55ejacksonyeah, the function always returns the same type: Vector.
05:55ejacksonirrespective of how many results you have. Dunno really, don't use korma myself, but that'd be my guess.
05:58wingybbloom: that was the issue thx
06:09SgeoYou know what would be AWESOME (and difficult)
06:09SgeoMaking a macro that takes a macro and a body. The macro expands to body except using the given macro for function application
06:10SgeoWhat I'm aiming for is something similar to making a new language in Racket by changing #%app
06:11SgeoBy doing that, we could have a pervasively-lazy sub-language, a pervasively-lifting ... thing for frp
06:11Sgeoetc. etc.
06:16bbloomSgeo: you could try the cljs analyzer and walk it looking for :invoke forms
06:16bbloomsounds like far more trouble than it's worth tho
06:16SgeoAlmost the flexibility of Racket would be really fun
06:17SgeoAlthough Racket shows more than just #%app
06:17SgeoThere's also a form that wraps around entire modules, I think
06:17SgeoBut that's relatively easy
06:24callenxificurC: like black metal?
06:24xificurCcallen: not really
06:24xificurCim not a satanist either
06:25xificurCfairly common questions because of my nickname
06:25callenxificurC: I wasn't going to ask about Satanism.
06:25callenxificurC: I'm just really into black metal and was sorta hoping your name meant you'd be a fan. alas.
06:25callenso does anyone here use ritz?
06:26xificurCcallen: I'm not saying you'd think that, I was just saying it because people sometimes ask that too
06:26xificurCwhats your fav band, maybe I know it :)
06:26callenxificurC: I'm sorry to hear people you talk to are unimaginative as to the purpose of your name.
06:27callenxificurC: lately? Burzum, Heretoir, An Autumn for Crippled Children, Svarti Loghin, Alcest, Drudkh, Pale Chalice
06:29xificurCcallen: well yeah but I still think its an achievement from their side because some online friends I had came to me after one year saying "OH your nickname,I just got it!"
06:29Raynescallen: You listen to terrible music.
06:30xificurCcallen: nope sorry, dont know any :( I think I only know some of the old metal bands that everyone knows :)
06:31callenRaynes: I don't have any curses worthy of this moment that bear uttering in this channel.
06:32callenRaynes: may the great Satan of Black Metal himself forgive thee :)
06:32AimHerecallen doesn't listen to any band that hasn't either murdered another musician or burned down 3 churches. That's how he knows that they're keeping it real
06:33callenAimHere: knows my soul.
06:34RaynesI'm fine with the church burning. I just don't typically link bands with names that sound like they're out of the Satanic bible.
06:34borkdudeI used to listen to Cradle of Filth and Dimmu Borgir, but does that still count?
06:35borkdudenot a big fan anymore though
06:36borkdudenever was really, but I'm generally into different kinds of metal
06:36callenborkdude: no.
06:36callenborkdude: those bands are pop culture caricatures
06:36borkdudecallen yes, I expected that
06:36callenRaynes: there's nothing satanic about my music.
06:37callenborkdude: that said, there are a few dimmu borgir songs I like.
06:37callenRaynes: for that matter, black metal is far from the only genre I listen to.
06:37callenI was listening to Punjabi folk music 5 minutes ago.
06:37RaynesOh, well that makes it all better.
06:37Raynes:p
06:37SgeoI like Cradle of Filth's Castlevania cover
06:38SgeoI think that's how I originally heard that song
06:38SgeoErm, I don't think the song itself is called Castlevania, but it's some soundtrack for Castlevania
06:38callenSgeo: the songs from the game people tend to cover never really had official names. They were made up after the fact.
06:39callenSgeo: but it was probably the intro song.
06:39callenthat's the most famous one.
06:52Raynescallen: You like Castlevania games?
06:52RaynesI played Lords of Shadow a recently. Really enjoyed it.
06:52RaynesI need to play SotN
06:53Sgeo"For example, the #%app syntactic form can be overridden to change the semantics of function application."
06:53SgeoI think this is a really good idea.
06:53SgeoAnd is what I'd love to emulate
06:55ibdknoxRaynes: SotN is one of my favorite games
06:55Raynesibdknox: It's in the xbox live arcade. I'll buy it when I get a chance.
06:56RaynesAnd by chance I mean "dollar to my name".
07:06bbloomif you guys haven't also played Shadow Complex, highly recommended for fans of the castlevania exploration style game
07:10pmaesI'd like to call a series of functions sequentially with a fixed delay between each call. Currently doing this without delay, so simply mapping function application over the arguments. What would be the most idiomatic way to do this?
07:11bbloompmaes: what kind of delay?
07:11bbloomlike a thread blocking delay?
07:12pmaesbbloom: Yes, indeed
07:12bbloompmaes: that sounds pretty UN-idiomatic to start with
07:13bbloomwhy not create a java Timer object with a queue?
07:14pmaesbbloom: I'll look into that, thanks. Sorry, I'm new to both Clojure and the jvm ecosystem.
07:14bbloompmaes: are you also new to concurrent programming?
07:14bbloom(also, never apologize for being a beginner... everyone was a beginner at somepoint!)
07:15pmaesbbloom: Yes, this is also my first time exploring concurrency.
07:16bbloompmaes: concurrency is complex and the learning curve is steep. you may want to avoid learning java, concurrency, and clojure all at the same time
07:18borkdudebbloom unless he's into concurrent learning ;)
07:18AimHereYeah, he should throw in a brand new IDE while he's there
07:18borkdudeemacs and paredit, writing down notes in org-mode
07:18pmaesWell, my emacs config is growing steadily :)
07:19bbloomborkdude: it's too bad that human brains appear to be single core, otherwise he could do some parallel learning too!
07:20borkdudebbloom your name reminds me of bloom filters btw
07:21bbloomborkdude: sadly, i'm not related to Burton Howard Bloom. woulda been cool to have a smarty pants algorithm inventing relative
07:23pmaesI have no background in CS (biochemist), is there a recommended source to read up on concurrent programming? Especially from a functional pov.
07:24bbloompmaes: no background as in no *formal* background? or as in no real experience whatsoever?
07:26pmaesbbloom: No formal background, no proper fundamentals. I've been learning in a scattershot manner, to solve specific problems.
07:26callenpmaes: you're kinda fucked. you're a biochemist you say?
07:27bbloomhaha he's not fucked
07:27callenpmaes: what you are, at the moment, is a middle-schooler asking how to be told how virus engineering works, specifically, but doesn't know any organic chem.
07:27callenpmaes: you could probably kinda sorta fake it with some cargo cult, but you should be prepared to learn how to program, bottom-up, but with the emphasis on concurrency unless you're more competent than you imply.
07:28bbloompmaes: http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601
07:28callenI knew you were going to link that book.
07:28bbloomthat book is probably your best bang for buck to learn concurrent programming
07:28pmaescallen: The difference being that I'm very willing and prepared to learn it. I have no delusions about my progress.
07:28callenit is, but if they're as naive as they claim, that's going to hella rough.
07:29callenpmaes: well if such a middle-schooler approached you, would you link them a book on virus engineering or something more foundational?
07:29pmaescallen: I get your point. Do you have any suggestions on a reading list?
07:29callenpmaes: you're an intelligent person, SICP alone might be sufficient to bridge you over to a book on concurrency like the Goetz book.
07:30bbloompmaes: SICP is always a good choice. and it's free http://mitpress.mit.edu/sicp/full-text/book/book.html
07:30bbloomwill teach you scheme too
07:30callenbbloom: I said the same, but you bothered to link it :P
07:30bbloomwhich is a good start towards clojure
07:30bbloomcallen: i was agreeing with you...
07:31callenbbloom: well if you have an otherwise educated and intelligent but totally naive individual, SICP is pretty choice.
07:31callenand he already wants to learn Clojure apparently, so it was a good match.
07:31callenif they're completely out of the water I just link them Zed Shaw's work.
07:31callenbbloom: it really is a pity you're not related to the bloom filters guy. We could use that to propagandize Clojure :P
07:32bbloompmaes: SICP also has a chapter on concurrency, which might help you enough
07:32callenpmaes: resist the temptation to read ahead.
07:32bbloompmaes: i envy you, i wish i could read SICP again for the first time. it blew my mind :-)
07:32callenpmaes: programming is more like martial arts than mathematics.
07:32callenin terms of how it's learned, anyway.
07:33callenI'm just #haskell would disagree, but w/e
07:33callensure*
07:33bbloompmaes: does all that help?
07:52pmaesbbloom: Most certainly. Thank you very much. callen as well. I'm starting SICP now and will leave the jvm-specific information for later.
07:53callenpmaes: capital.
07:59milos_cohagenman, i find this langauge rough.. from http://clojure.org/Namespaces.. "Vars can be interned in a namespace, using def or any of its variants, in which case they have a simple symbol for a name and a reference to their containing namespace, and the namespace maps that symbol to the same var."
08:00callenmilos_cohagen: that's not literature for noobcakes.
08:00callenmilos_cohagen: for the purposes of pedagogy, lets say that a var is just a reference or a pointer or a box around some value.
08:01callenmilos_cohagen: a namespace contains a collection of vars.
08:01milos_cohagenroger
08:01callenmilos_cohagen: also, buy a book. I recommend Clojure Programming.
08:03milos_cohagenreading 'joy' now, i'm making more of a point that the description in the docs is hard to parse for me, ur avg programmer
08:04milos_cohagenspecifically, "..they have simple symbol for a name and
08:04milos_cohagen+a reference to their containing namespace"
08:05bbloommilos_cohagen: i agree with you, a lot of the core docs are pretty terse
08:05bbloomplus they have a lot of odd conjunctions, etc
08:05bbloomthey also are intended to be read by people who already know all the jargon
08:05bbloomwhich makes them extra tough
08:05milos_cohagenso, what does, "symbol for a name" mean?
08:06milos_cohagenyeah thx bbloom
08:06bbloomthere are three things that look similar until you squint just right
08:06bbloomsymbols are things like 'foo
08:06bbloomthey are names that can refer to some other value somewhere
08:06bbloomthen there are vars, which are things like #'foo
08:07milos_cohagenyep yep
08:07bbloomthey are sorta like symbols, but they refer to "globals" function definitions, things like that
08:07bbloomthen there are keywords that look like :foo
08:07bbloomthey are sorta like symbols, but they always refer to themselves
08:07bbloomvars have names
08:07bbloomthose names are symbols
08:07bbloom,#'inc
08:07clojurebot#'clojure.core/inc
08:07bbloomthat's a var
08:07bbloom,(class #'inc)
08:07clojurebotclojure.lang.Var
08:08bbloom,'inc
08:08clojurebotinc
08:08bbloom,(class 'inc)
08:08clojurebotclojure.lang.Symbol
08:08bbloomthat's a symbol
08:08bbloomsymbols and vars live in namespaces
08:08bbloom,`inc
08:08clojurebotclojure.core/inc
08:08bbloom,(class `inc)
08:08clojurebotclojure.lang.Symbol
08:08bbloomkeywords, however, don't
08:08bbloom,:inc
08:08clojurebot:inc
08:08bbloom,':inc
08:08clojurebot:inc
08:08bbloom,`:inc
08:08clojurebot:inc
08:09bbloom,(class :inc)
08:09clojurebotclojure.lang.Keyword
08:09bbloomthat doc string is telling you this:
08:09bbloom,(class (:name (meta #'inc)))
08:09clojurebotclojure.lang.Symbol
08:09bbloomget it?
08:10milos_cohagenforgive my silence while i take it all in.. tyvm
08:12tufflaxThe important point is that symbols are like identifiers in other languages, but in clojure symbols are themselves values. So you can do (def foo 'foo) and then (eval foo) will yield foo, and (eval (eval foo)) too, and so on. (def foo 'foo) stores the symbol foo in the var that has the name of the symbol foo in the current namespace.
08:13tufflax...I think, correct me if I'm wrong :P
08:14bbloomtufflax: nope, you're on point
08:28firesofmayHi, I have small question. I want to append a string using a regex match. I need to get all the files inside a directory and subdirectory of patterm *.m I tried using conch library for this, but find doesn't seem to work recursively. Any pointers?
08:35tufflaxbbloom, btw symbols doesn't necessarily lives in namespaces, do they? I mean, 'foo is just a value like 1, right?
08:36bbloomtufflax: symbols *may* live in namespaces, vars *always* live in namespaces
08:37tufflaxfiresofmay, I don't know what you mean by "I want to append a string using a regex match." But you can perhaps just use java Files and and make a recursive function yourself with list() and isDirectory(), or something :P
08:38tufflaxor listFiles()
08:39bbloomdammit. how did it get to 530 am. gooood night
08:39milos_cohagenbbloom and tufflax, thx a lot, i'm reading and playing in the repl with all u said
08:40firesofmaytufflax, okay will check that out.
08:44tufflaxmilos_cohagen, you can create symbols out of strings with (symbol "foo") and get the string back with (name 'foo). But they are perhaps most useful for macros. They docs are a little bit short when it comes to macros though :p
08:47milos_cohagenyeah i'm in my pre-macro stage of learning, thx much for the help
08:49tufflax:)
08:52SgeoPossibly a good way to learn macros is by reading about Common Lisp macros, although there are some subtle differences
08:58milos_cohageni'm about 1/2 way through sicp, little schemer, and starting 'joy' just now. i'm a long time java programmer who got my eyes opened up when i started learning javascript a couple years ago
08:58tufflaxmy stepping stone was python :P
08:59Ralthm, people
08:59milos_cohagenha yeah once you taste a functional language
08:59Raltin lisp, if I want to use a let'd variable in the same let, I have to use let*
08:59Raltis there something similar in clojure?
09:00AimHere,(let [a 1 b a] b)
09:00clojurebot1
09:00Raltalright, cool :)
09:01tufflaxNow it's hard to get motivated to learn something new. But I'm learning Haskell too become a better clojure programmer, not because I think I will use it .P
09:01tufflaxto*
09:03milos_cohagenmy motivation level in learning programming has gone up and down a cycle or two in my life
09:04tufflaxI've always been motivated to learn but with clojure it's hard to imagine there is something better out there :P
09:06milos_cohageni kick myself now at age 35 that i spent some years on auto-pilot cranking out java code by day, but not learning at same time
09:06tufflaxhehe
09:07milos_cohageni'm re-invigorated now that fp got a hold of me
09:08tufflaxyeah, it's fun
09:08tufflaxI love macros too :p they are so nice when you need them
09:11tufflaxmilos_cohagen, maybe you are more experienced than I am and know this stuff already, but this video really helped me become a better programmer and appreciate clojure http://www.infoq.com/presentations/Simple-Made-Easy
09:11piskettimilos_cohagen: Well said, sir. I have felt the same :)
09:11Raltok... how the hell do I define clojure.contrib.math as dependency?
09:15tufflaxRalt, I may be mistaken. But using clojure.contrib is the old way of doing things I think. I usually look for libs on github. Like maybe you want these https://github.com/clojure/math.numeric-tower https://github.com/clojure/math.combinatorics
09:15RaltI just want Math/round :(
09:16tufflaxit's in that numeric-tower :p
09:16tufflaxdo you use lein?
09:16Raltyeah
09:16tufflaxyeah, so then it's easy to get it :P
09:16Raltah alright, found it
09:16Raltthanks
09:19piskettiRalt: For future reference http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
09:20Raltthanks :)
09:20RaltI just saw plenty of old contents, so couldn't get anything right
09:21callenmilos_cohagen: it's never too late.
09:21callenmilos_cohagen: don't ever let negativity creep into your brain at a time when you are trying to improve yourself. Reward your ego for seeking self-improvement. Most people spend their whole lives never trying any harder they have to in order to keep a paycheck.
09:21callenmilos_cohagen: eat some chocolate, drink some nice coffee, write some code. :)
09:22callenmilos_cohagen: my mother is in her 50s, I'm still trying to get her to take up coding period, let alone getting better at it.
09:23callenbbloom: you know, my point about the docs being terse and insufficient might be alleviated by something like a wiki...carthago delenda est...
09:23pisketticallen: good points. I'd also add that it's important to surround yourself with enthusiastic ppl. Eg. a user group.
09:23Raltclojure's being mean with me
09:23callenRalt: it can be a stern mistress.
09:24callenRalt: not near as bondage-and-discipline as Haskell though! :D
09:24p_lcallen: Haskell however gives you harsh time till you switch the roles ;)
09:24callenp_l: yeah, sure, then you have a space leak when you scare it too bad.
09:25callena space leak allll over the bed.
09:25callenpisketti: It's my hypothesis that people don't actively seek self-improvement, because to do so would mean confronting all the previously misused time.
09:25callenas a result, I exhort people vigorously to put the negative thoughts aside.
09:26p_lcallen: it's called "brain damage" (and sometimes "natural optimist") ;)
09:26pisketticallen: My hypothesis is that not being exposed to new things and passionate practioners leads to sticking to your comfort zone and eventually apathy.
09:26Raltokay -- pushed my code somewhere. With these deps https://github.com/Ralt/web-account-clojure/blob/master/project.clj and lein deps run, loading this file in nrepl throws me "FileNotFoundException could not locate math..." https://github.com/Ralt/web-account-clojure/blob/master/src/my_website/models/account.clj
09:26p_l(n.b. - research actually found that "naturally optimist" people have a difference in frontal lobe that stops them from being able to perceive nearly half of the negative ideas)
09:27callenpisketti: being exposed to passionate individuals definitely helps. There's a lot of factors involved in anything this complicated.
09:27callenI, for one, rather adore this IRC channel.
09:27pisketti:D
09:27callenexcept Raynes.
09:28p_lcallen: it also helps to actually go down and hit bottom once. Teaches you a bit of a different outlook at life
09:28callenanybody glancing at this terminal have an opinion on a ClojureWiki?
09:28abaranoskcallen I second that about Raynes
09:28callenI really love EmacsWiki and think it would fantastic for Clojure.
09:28abaranoskcallen: I've never heard of it
09:28callenabaranosk: you'll add me to that list soon.
09:29callenabaranosk: my second favorite wiki of all time: http://emacswiki.org/
09:29pisketticallen & call: the science of motivation is interesting
09:29abaranoskso just a freeform anything goes, Clojrue wiki? What does it add that community lacks currently?
09:29callenpisketti: LW?
09:30callenabaranosk: a wiki.
09:30abaranoskhey where'd the 'y' in my name go?
09:30piskettisorry, callen & p_l that was :)
09:30piskettiLW?
09:30callenabaranosk: I'm considering some semi-novel models for structuring and editing.
09:30callenpisketti: testing to see if you were into a sub-community I lurk.
09:30piskettiapparently not :|
09:30abaranoskcallen: in general, I love wikis!
09:31callenpisketti: Elizer Yudkowsky's cohort, LessWrong, all that. They analyze things like motivation.
09:31callenabaranosk: what do you think suffices in its absence at the moment?
09:31callenabaranosk: I like the ClojureWerkz stuff but it's not the same.
09:31pisketticallen: I'm only familiar with the popularised stuff like the Drive by Dan Pink :)
09:32callenpisketti: oh, I follow a bunch of weirdo itinerants obsessed with cryonics, bayesian reasoning, and the singularity.
09:32callenpisketti: motivation is a testable hypothesis for them.
09:32callenpoint being, you can experiment to figure out what works to motivate people.
09:33callenabaranosk: anyway there's a lot of collected wisdom with regards to idioms, 'good practice', and the rest to Clojure that currently isn't being collected or documented. Is there a website or community where this is happening that I'm not aware of?
09:33piskettiAny key takeaways?
09:33abaranoskcallen: I don't think anything has really captured the hearts and minds of thec ommunity
09:33pisketticallen: Say for a team member/coach
09:34AimHereClojure's wisdom is distributed evenly across the entire internets
09:34callenpisketti: people are highly irrational, social pressure and expectations influence people strongly, work ethic can become a habit. People are generally more motivated by intangibles and well-wishing than economic motivators.
09:34callenpisketti: here's a hint
09:34piskettiThat I agree with
09:35piskettifinancial incentives just plainly do not work
09:35callenpisketti: part of the reason the YC crew focuses so much of their investment decisions on how well the founders get along with each other, and how they know each other is that they know a founder is more likely to hang with it when times are rough if they have a friendship with the other founder(s)
09:35AimHereWell there is a minimum threshold of financial comfort that you need, beyond THAT, the financial incentives stop working
09:36callenpisketti: if you can give a reason to care about the outcomes you want them to care about in a social context, you're a lot better off.
09:36piskettiAimHere: that is true
09:36callenAimHere: last study I saw put the number for people living in the US at about $70-90k
09:36callenafter that, the hedonic treadmill took over.
09:36pisketticallen: makes sense
09:36callensadly, I don't have good numbers on cost of living for that.
09:36AimHereHeh, the hedonic treadmill?
09:37callenAimHere: your happiness tends to level off to its neutral/resting state regardless of external jolts.
09:37callenAimHere: if you're a miserable person, 6 months after winning the lottery you'll still be miserable.
09:37pisketticallen: what is sad is that firms are still lead with outdated knowledge
09:37AimHereRight, though I was just wondering how the term 'treadmill' fit in there.
09:37callenthere are some hypotheses on making permanent adjustments to your "resting state"
09:38pisketticallen: like the fact that engaged and happy ppl are way more productive
09:38callenpisketti: my concerns are somewhat smaller in scope, I'm a startup kid. I just have to motivate a small team of people, not convince a bunch of chairmen of the board.
09:38callenAimHere: because it refers to the fact that if you up the "goodies" in your life, the treadmill just catches up with you
09:38AimHereHang on, if the scientists all believe that happiness generally maxes out at $90k per year, isn't that an argument for a maximum wage! 100% tax at $100K
09:39AimHereWon't make people more miserable
09:39callenAimHere: no because there's utility to income beyond that that grows the economy.
09:39piskettiI'm mostly concerned about my team as well but at the same time I'm trying to inject these ideas to upper management 8)
09:39abaranoskcallen: I'm not a huge beleiver that people can be motivated
09:40callenpisketti: I sometimes have to cope with the alien psychology of investors/VCs who come from a more corporate background. I try to ignore their ideas on HR and focus on the business stuff.
09:40abaranoskbut if I had to fin d away, I'd look for things that those people are already motivated by, and then frame what we're doing currently in terms that match what already motivates them
09:40piskettiI feel for you :)
09:40callenabaranosk: directly? me neither. indirectly? maybe. You have to create legitimate reasons for people to care, not just try to manipulate them.
09:40AimHerecallen, who cares about economic growth? You maximise happiness by evening out the incomes, and nobody'll care if the economy shrinks ;)
09:41callenAimHere: well believe it or not, $90-100k per annum incomes don't happen without economic leverage and that economic leverage doesn't happen without new growth.
09:41abaranoskcallen where are you working currently? I see you're also in the Bay Area
09:41callenfew people are literally directly performing that kind of value of work, it's leverage that comes from providing value to a business model that multiples the utility across X customers.
09:42AimHereWell the growth will come because the people making significantly lower than $70k will have more money to spend
09:42callenabaranosk: at a startup
09:42abaranoskthat's almost everyone here though :)
09:42callenabaranosk: I live and work in Mountain View at the moment for a nutrition/food startup.
09:43callenwith that much information and Google, you can track me down in 5 minutes.
09:43piskettiabaranosk: apparantly you need to be in a startup if you want to be writing clojure for a living
09:43abaranoskRuna's old office was in Mountain View. I lived there for a few months
09:43callenabaranosk: we're in the same building as YourMechanic
09:43piskettiexcept that I'm in a big corporation writing Clojure for a living ;)
09:43abaranoskcallen: do you guys use Clojure
09:44callenpisketti: I don't write Clojure for a living, I write Python. My side projects are in Clojure.
09:44callenabaranosk: no, I tend to be conservative when it comes to technological decisions made in a business context.
09:44abaranoskhow do you like Python?
09:44callenabaranosk: used it for years, like it fine because I can project my version of FP onto it. Clojure has replaced it for side projects for quite awhile now though.
09:44pisketticallen: My (rather limited) experience is that Clojure is definitely mature enough by now
09:45callenmyself and dustingetz are the only people I know of that have even taken monads seriously in the context of Python.
09:45callenpisketti: it's not even really about maturity.
09:45pisketticallen: what then?
09:45callenpisketti: conservativism in this context means that I can estimate deliverables and product deadlines much more readily with something like Python than Clojure.
09:45callenfor now.
09:45callenpisketti: I cannot take unnecessary risks, startups are risky enough. There is no fallback for a startup. Product has to be shipped ASAP, week in, week out.
09:46piskettihmm, apparently you have a team of senior python hackers?
09:46callenpisketti: yes, a team doing dev-ops, backend, API, database, search, automation. A team of 1. me.
09:46piskettiI think one of the key benefits of using Clojure is the speed. The ability to ship sooner.
09:46abaranoskMan there are so many Korma issues. Hard to decide what to handle first.
09:47pisketticallen: it obv depends a lot on the context
09:47callenpisketti: maybe, maybe not. I take *knowing* something very seriously. I'm not willing to guess. I wanted more experience in Clojure before I subjected a business to my technological whims.
09:47piskettithe domain, the ppl etc
09:47abaranoskClojure isn't about raw speed though, more about simplicity over time
09:47pisketticorrect
09:48callenClojure tends to have a most profound advantage once your problems reach a certain level of complexity.
09:48abaranoskcallen: I think that is a very good point (knowing) At some point though, you need experience in the field to complete the full knowing
09:48callenup to that point, it's likely a wash and most of any difference will be up to programmer proficiency.
09:48piskettiabaranosk: I find FP specifically helpful there
09:48callenabaranosk: that's what the side projects are for. I'm building an end-to-end product in Clojure and ClojureScript.
09:49callenso that I *know*
09:49abaranoskwhat are you using for the project?
09:49callenI don't know what you're asking, I'm sorry.
09:50abaranoskdo any of you all have any preference for any of the outstanding Korma issues?
09:50callenabaranosk: are you asking what libraries I'm using?
09:50abaranoskcallen: Sorry, I meant which libraries are you using?
09:50abaranoskhehe
09:51callenmigratus, korma, ring, compojure, hiccup
09:51callensoon, luminus. I've been tinkering with that with yogthos.
09:52abaranoskwhen I started this project at work that needed SQL, I looked for schema a migration library, but they all seemed overkill
09:52callenabaranosk: migratus is pretty lightweight. You just write *.sql files.
09:52abaranoskwe ended up using some code taken out of the clojars website github repo
09:52callenit migrates each file individually in timestamp order.
09:53abaranoskMaybe I should take a look at migratus
09:53callenabaranosk: especially since I just got done harassing pjstadig into fixing it.
09:53callenso that work has already been done. cheers.
09:54abaranoskcallen: so you are also up at an ungodly hour then? You're not in China or something?
09:54callenabaranosk: just needed a few changes for lein2
09:54callenabaranosk: no, I don't have time to travel. I'm simply up at an ungodly hour. My circadian rhythm is 25-26 hours long and when vacation time hits, I start slip slip slipping into the future.
09:55abaranosksame thing happens to me actually
09:55ChongLihi, anyone here with clojurescript/gclosure experience?
09:55ChongLiI'm trying to use piggieback to start a browser repl
09:56ChongLiand I keep getting this error
09:56ChongLiUncaught Error: Undefined nameToPath for goog.async.Deferred
09:56ChongLiit seems to be a missing dependency in the closure library
09:56ChongLiI don't know why it would be missing though
09:57callenChongLi: https://groups.google.com/forum/#!msg/clojure/6FvdB9yFOzI/tBpPaZWok34J
09:58callenabaranosk: you got my first ghub issues vote.
09:58callensecond vote.
10:09abaranoskcallen: I don't see it..... link?
10:10callenabaranosk: look at the github issues or the recent comments on github issues.
10:11callenabaranosk: example here: https://github.com/korma/Korma/issues/101
10:14abaranoskcallen thanks. I'll think about this deeper when I'm less tired. In gneral, connection pooling seems to be a issue that is effecting a lot of different people/issues. I want to make sure the final solution makes sense all around
10:17callenabaranosk: no solution is final, but you might be able to make connection pooling a non-problem long enough to create breathing room to address other things without having to come back to it regularly.
10:20abaranoskcallen: yep, I'm considering the angles. I need a little more time to digest
10:43Seba51Is there an alternative to lein-auottest for leiningen 2?
10:46RaynesI wrote a prerequisite library planning to write an alternative to it, but never got around to it.
10:46Seba51So it needs to be ported to Leiningen 2.
10:46SgeoWell. I found a monads library worse than clojure.algo.monads.
10:47SgeoDidn't think it possible.
10:51RaynesSgeo: Hah
10:52SgeoIt's similar to clojure.algo.monads except there's no monadfn and no other way to define a function that works with monads unless it itself does with-monad
10:52abaranoskMonads are those thing you use to make simple problems fancy problems, right?
10:52Seba51Which test frameworks are used in the community. I used clojure.test and midje in my first experiences.
10:53abaranoskthere are a couple other niche ones I think as well
10:53abaranoskexpectations for one
10:53Raynesabaranosk: Is this the username you plan to use from now on on IRC?
10:54abaranoskalso, speclj
10:54Sgeodo-> in Enlive is sort of a macro that represents a concept that would work as a monad
10:54abaranoskRaynes: no, Linkinus went crazy
10:54Seba51ä#
10:54Seba51daughter was typing
10:54Raynesabaranosk: What do you want to use?
10:54abaranosk(in other words I haven't been bothered to figure out how to change my name yet)
10:54Sgeo/nick newname
10:54abaranoskalex_baranosky
10:55Raynesunderscores are for wimps.
10:55abaranoskI stand as accused!
10:55RaynesHow about alexbaranosky?
10:55RaynesOr baranosky
10:55RaynesSurely there isn't anyone else on freenode named baranosky
10:56abaranoskRaynes: you are caring a confusingly lrge amount about this :)
10:56baranoskyNope, there isn't.
10:56abaranoskmaybe I'm just too tired to understand
10:56RaynesI'm giving you an account on my ZNC instance.
10:56Raynes:p
10:56RaynesI'm picking you an IRC nick.
10:57yogthosRaynes: hey, so I saw we made a doodoo in our checkin for 0.3.0 making some unit tests right now :)
10:57yogthosRaynes: we should hook up travis for next time too
10:57Raynesyogthos: Thank you. I'd rather be named baranosky than write lib-noir tests.
10:57yogthosRaynes: :) no prob
10:58Raynesyogthos: Don't bother pushing to a branch for the tests. Just push 'em to master and I'll hook up travis when theyr'e done.
10:58abaranoskRaynes: aha it all makes sense now
10:58abaranoskthen alexbaranosky ???
10:58lazybotabaranosk: How could that be wrong?
10:58RaynesSure. Winner.
10:59yogthosRaynes: ok I'll stick some in soon :)
11:00Raynesabaranosk: This will just take a moment and won't hurt a bit.
11:00RaynesBlast!
11:00RaynesHe probably went to bed.
11:00RaynesI decided to not go to bed.
11:00RaynesBecause I can't sleep.
11:00RaynesI'll take a nap later.
11:00RaynesThe baranoskynater
11:01Raynesabaranosky: Have you registered alexbaranosky yet?
11:02RaynesHe isn't very good at IRC.
11:02alexbaranoskytada
11:03ChongLigah, now you're the same colour as Raynes
11:03Raynesalexbaranosky: Have you registered it yet?
11:03alexbaranoskyRaynes what do I have to do to register it?
11:03Raynesalexbaranosky: Type the following: /msg nickserv register mypass myemailaddress
11:04RaynesDon't over think the password. The day someone tries to steal your nickname is the day I do jumping jacks on Mars.
11:04AimHereI may have to see that.
11:05RaynesYou'd need a really good telescope.
11:05alexbaranoskyRaynes: done
11:05RaynesExcellent
11:05ChongLinah, I'd just watch it on the live video feed from the rover
11:05AimHereYou'd need a really good Space Program. I think I'll get what I need before you
11:05RaynesOkay. Now this is the hard part.
11:05alexbaranoskyRaynes: never say never with the Mars jumping jacks thing
11:05Raynesalexbaranosky: Going to private message you with instructions.
11:05alexbaranoskyanything can happen
11:06alexbaranoskycool
11:30andrewmcveighAnyone know if it's possible to write an "OR" query with sql korma's map syntax? Something like (select foo (where {:id [or 1 2]})) - can't seem to find how to do it.
11:34alexbaranosky(select foo (where (or {:id 1} {:id 2})))
11:35Raynesalexbaranosky: Success!
11:35alexbaranoskyandrewmcveigh: when in doubt, check the tests: https://github.com/korma/Korma/blob/master/test/korma/test/core.clj#L138
11:35alexbaranoskyRaynes: high five
11:36andrewmcveighalexbaranosky: ah, OK thanks.
11:37alexbaranoskyman I love Indian food.
11:38andrewmcveighalexbaranosky: the docstring for "where" sort of suggests you can use it in the same way as "like", etc.
11:40hyPiRion~factorial
11:40clojurebotfactorial is not something you need alphanumeric characters for: https://gist.github.com/3036120
11:41alexbaranoskyandrewmcveigh yeah, you can use it like those too
11:41hyPiRionOh sweet, clojurebot's back
11:42alexbaranoskyandrewmcveigh (select foo (where {:id [or 1 2]}))) ;; does this work?
11:44andrewmcveighalexbaranosky: no, doesn't work here...
11:45andrewmcveighit's expanding to: SELECT "foo".* FROM "foo" WHERE (("foo"."id" OR ?)) :: [1]
11:46alexbaranoskywonder if that's a bug... there's no unit test for this, so it could be one
11:47dbushenkoalexbaranosky, when do you plan to push beta12 to clojars?
11:47Raynesalexbaranosky: Also, worth noting that znc doesn't log IRC conversations anywhere that I know of, so feel free to visit any number of cyber sex channels without me ever being the wiser.
11:47alexbaranoskyfor now use the syntax I gave first then, we need a bug report, and me fixing it :)
11:47alexbaranoskydbushenko: I've just started leading the proejct and am getting up to speed still, but certainly within a week
11:48dbushenkogreat!
11:48alexbaranoskyRaynes: good to know :)
11:48dbushenkobtw, thanks for maintaining korma!
11:48alexbaranoskydbushenko sure thing. Just don't be too hard on my while I get a little more up to speed.
11:49dbushenkosorry :-)
11:49alexbaranoskyI was joking mostly
11:49andrewmcveighalexbaranosky: OK, the other syntax doesn't really work for me, but I'll work around. You want me to create a github issue?
11:51alexbaranoskyandrewmcveigh: issue would be great. Were yo saying it doesn't work for your use case... or that it also doesn't work?
11:52andrewmcveighalexbaranosky: for my use case. I really could do with passing a map in, as I'm not writing the query manually.
11:54alexbaranoskyandrewmcveigh: understood. I'm going to look into this now. Most of these aren't covered in the unit tests, so there may be some bugs hiding: [=, like, and, or, >, <, >=, <=, in, not-in, not, not=]
11:58andrewmcveighalexbaranosky: Cool, haven't noticed other probs with the predicates, but probably haven't used them all. BTW, is there a non-horrible way to add a predicate? I needed 'ilike for postgres's case insensitive like, but had to resort to 'alter-var-root ... :-O
11:59alexbaranoskyandrewmcveigh: no there is not, but maybe we should explore making the preds extensible
11:59alexbaranoskyandrewmcveigh: I was just looking through the list of predicates, 'and' seemed weird
12:00alexbaranoskyI am not sure what it would really mean to say (where {:id [and foo bar]})
12:01andrewmcveighalexbaranosky: Yeah, I'm not sure how that would be of any use...
12:02alexbaranoskyI'm adding unit tests for these now.
12:03andrewmcveighgreat :), do you still want the issue writing?
12:04Raynesalexbaranosky is so cute, maintaining his korma.
12:05RaynesHe should post about his maintainership to hacker news and get some korma karma.
12:05RaynesMy life is complete now that I've used those two words together in a sentence.
12:05hyPiRionRaynes: All these years
12:05hyPiRionwaiting for the perfect moment,.
12:06dbushenko:-D
12:23RaynesAnybody else debug an issue for 30 minutes and realize the stupid reason for it and immediately vocalize some weird "ABLUGHABLUGADUUUUUUH" sound?
12:24ChongLiRaynes: the sound doctor zoidberg makes when he flutters his tentacles?
12:25RaynesSometimes.
12:26hyPiRionI tend to do that if I realize that when I'm dealing with spaghetti code going outside the project I'm working in and into APIs I'm using
12:27hyPiRion/s/when//
12:44Raltis there the 1+ function in clojure?
12:45alexbaranosky`inc`
12:45Raltin CL, (+ 1 2) can be done with (1+ 2)
12:45alexbaranosky`inc`
12:45ChongLi,(inc 2)
12:45clojurebot3
12:45Raltk. Thanks.
12:46ChongLiRalt: http://hyperpolyglot.org/lisp
12:46ChongLifor a nice chart comparing everything
12:47Raltha. thanks :)
12:48Raltsymbols are case sensitive?!
12:48Raltdamn. I better read that chart.
12:48ChongLithere are a lot of little differences
12:48ChongLibesides common function names
12:49hyPiRion,(let [+* +, + println] (+ 1 2))
12:49clojurebot1 2
12:49hyPiRion^lisp1
12:49technomancyaaaaah don't read hyperpolyglot
12:50technomancyit's really unhelpful and superficial
12:50ChongLitechnomancy: why not?
12:50ChongLiis it indicative of an incorrect approach?
12:50ChongLi(that of trying to directly translate idioms from one language to another)
12:51technomancyyeah, it's coming from a CL perspective and trying to find matches where they aren't actually intended for the same thing
12:52technomancyplus a lot of things are just straight up incorrect, like the clojure definition of atom
12:52Raltit's more knowing the differences so that I don't do stuff in clojure that I'd do in CL. Like, assuming case-insensitivity of symbols
12:53technomancyit also claims clojure doesn't support arrays?
12:53alexbaranoskymisinformation I tell you!
12:53RaynesKastupid
12:53ChongLithat is weird
12:53technomancyplus it tells you to use structs
12:54ChongLiclojure has make-array
12:54hyPiRionand into-array
12:54ChongLijeez, why would they say it doesn't?
12:54uvtcIt *is* nice though to see a concise summary of "here's how $this-lang differs from $that-lang". Way back when, I wrote up some of those myself at ruby-lang.org.
12:55technomancyit also seems to be confused about docstrings
12:55technomancyI could go on but I think you get the point
12:56technomancyuvtc: hey, do you know if there's any progress on a Clojure HTML UI for the clojuredocs.org API?
12:56dcb So I think I'm missing something obvious here, but: How do I start an nrepl server in a lein 2 project, and where/how should I specify what port it uses? If it makes a difference I'm trying to get vim-foreplay to connect to the server
12:56technomancysomeone was saying they wanted to help out with that
12:56ChongLiit also says you can't define an exception in clojure
12:56technomancydcb: :repl-options {:port 4005}
12:56uvtctechnomancy: no, but we could ask dakrone .
12:56ChongLican't you just subclass Exception
12:56ChongLi?
12:57tpopedcb: if you run "lein repl" foreplay will find it automatically
12:57clojurebotHuh?
12:57alexbaranoskyI think you need to AOT compile a gen-class?
12:57technomancyChongLi: yeah, but it's a bad idea. better to use ex-info
12:57alexbaranoskywhat he said
12:57RaynesAnd for those who missed it, he said to use ex-info
12:57technomancythe point is, the differences between the languages can't be meaningfully expressed in a table; it needs prose
12:58ChongLitechnomancy: I think you could say that about almost anything
12:58ChongLipeople love to create tables which misrepresent things
12:58tpopew3schools anyone?
12:58dcbtechnomancy, tpope: OK, thanks
12:59uvtctechnomancy: Ah, yes, I saw that in the irc logs at some point. Last I heard the project is https://github.com/dakrone/eisago , but not sure I understand yet exactly how that fits together.
13:00uvtcChongLi: I doubt it's intentional misrepresenting. It's tough for an author to be expert in *all* of them. :) And the people who *are* experts in all of them aren't always the ones motivated to write up the tables. :)
13:01seangroveAnyone using shoreleave in here? Having a very difficult time getting it to work with keywords-as-topics
13:03ChongLiuvtc: sure, but my point was that tables are often used in a rhetorical fashion
13:04ChongLiuvtc: this sort of thing: http://www.timothysykes.com/wp-content/uploads/2010/01/iPad-vs-Rock.jpg
13:04uvtcChongLi: hehe. :)
13:26bpranyone have any useful tips for debugging namespace load errors? Errors such as: "NoClassDefFoundError Could not initialize class"
13:32raekbpr: do you have a paste of the whole error?
13:33bprhttps://www.refheap.com/paste/7940
13:34bprhttps://www.refheap.com/paste/7941
13:34bpr^ the namespace declaration of the ns i'm trying to load
13:34raekhrm, this is not the "usual" "ClassNotFoundException" or "Could not locate foo/bar__init.class" errors...
13:35raekbpr: do you use ahead of time compilation?
13:35raekis your classes/ directory empty?
13:36bprno aot comp
13:36bprno, my classes directory isn't empty
13:36raekbpr: do you use "lein run" without any arguments?
13:37bprthat paste is from a repl session
13:37bpri did (require 'server.core)
13:37raekand do you have a :main entry in the project.clj without ^{:skip-aot true}
13:38bprhere's the output of a lein run: https://www.refheap.com/paste/7942
13:38bpryes
13:38raekif you have a :main entry without ^{:skip-aot true} before the symbol, then you are using AOT
13:38raeksadly
13:38bprproject.clj: https://www.refheap.com/paste/7943
13:38bproh ok
13:39raekreplace ":main server.start" with ":main ^{:skip-aot true} server.start"
13:39raekand remove everything in classes/
13:39raekand restart your clojure instance
13:40raekyou got the error because aot-compiled files were shadowing your new modified code
13:40bprah
13:40bprthanks
13:40raekaot just messes everything up...
13:40bprit's weird b/c i did a lein clean at one point earlier while trying to debug this
13:41bprlein run seems to work now
13:41bprthanks
13:41raekyou might need to look into this again if you want to make a uberjar, though...
13:42bprok
13:43Ralthmmm
13:45Raltit looks like emacs/nrepl doesn't pick up the new deps installed with lein
13:45Raltis there something to do?
13:45Raltor it's just that I don't know how to have multiple :use
13:45Raltand google doesn't provide any good pointer.
13:46raekRalt: have you restarted the nrepl instance?
13:46Raltnope
13:46Raltdo I have to?
13:46raekyes
13:47ppppaulwhat does the #() reader macro do?
13:47raekat least I think so. this is the case for "lein repl" and the old swank way
13:47Raltkk
13:47ppppauloh, nvm
13:47raekppppaul: is is a shorthand for (fn [...] (...))
13:47ppppaulforgot it was anon fn shortcut
13:48Raltwell, restarting doesn't change, guess my problem lies elsewhere :-)
13:48raekif you didn't get an error when you started the repl, then the dependency parts in the project.clj files were correct
13:48raek(and clojure should be started with access to those deps)
13:49Raltif I want to use :use several times, I do like this? (ns ... (:use some.dep) (:use other.dep))
13:49Raltk, good to know
13:49raekyes, but you shoulnd't use :use, use :require
13:49Raltoh well, guess so
13:49Raltit's just that all the noir tutorials use form-to
13:49Raltso I guess they :use hiccup.core
13:50raekah
13:50Raltat least I hope so
13:50raekanyway, prefer :require for new code :)
13:50Raltno, it's hiccup.form
13:51Raltyeah I guess
13:51raekthat's the problem with use... you cannot tell where a symbol comes from
13:51Raltwell it's nice for some cases
13:51Raltbut yeah, I get the point
13:51raekI think short prefixes work well enough
13:52raek(:require [hiccup.core :as h]) for example
13:52Ralttrue
13:52RaltI'll go with that
13:52Raltthanks for the advice
13:52raekalso, that you give to require and use does not have to correspond to the dependency name
13:53RaltI'll just use :use with :only I guess
13:54borkduderequire also supports :refer
13:54borkdudeso use is pretty much obsolete now
13:54Ralt:refer?
13:54gfredericksRalt: does the same thing as use/only
13:55Raltoh, handy
13:55borkdudehmm, clojuredocs should be updated to 1.4/1.5
13:56raekand it should not have a big link to clojure.contrib.* on the front page... :)
13:58gfredericksand it should let you search for things by name
13:58Raltany example of using require with refer?
13:59gfredericks(:require [foo.bar :refer [things in foo dot bar]])
13:59Raltthanks
13:59gfredericksyou can mix that with :as as well
13:59gfrederickssuper-nice
14:00borkdude(require '[clojure.set :refer [union]])
14:00gfredericksI guess for and and are hard so search for because they're common words as well
14:05ppppaulhow do i duck punch functions in clojure?
14:05borkdudeduck punch?
14:06ppppaulwrap a fn
14:06ppppaulbut with the same name
14:06borkdude(def + +)?
14:06ppppaulhmm
14:06hyPiRionwrap a fn?
14:07borkdude(def + (fn [& args] (apply + args)))
14:07ppppauli have a (find-id) fn in my ns. i want to overwrite it, but use the old find-id fn inside the overwritten fn
14:07AimHere,(let [+ -] (+ 4 3))
14:07clojurebot1
14:08borkdude(def find-id (fn [x y z] (find-id x y z)))
14:08ppppaulinteresting
14:08ppppaulthat wont throw a warning?
14:08borkdudeppppaul of course not, vars are mutable as hell
14:08hyPiRion,(let [+ (fn [a b] (if (odd? a) (+ a b) (- a b)))] (+ 1 2) (+ 2 2))
14:08clojurebot0
14:08hyPiRion,(let [+ (fn [a b] (if (odd? a) (+ a b) (- a b)))] [(+ 1 2) (+ 2 2)])
14:08clojurebot[3 0]
14:08ppppaulmaybe i was doing it wrong... i was using (defn
14:09hyPiRionyeah, with defn, you get recursion
14:09borkdudeppppaul hyPiRion you can avoid the recursion by using fully qualified name
14:09AimHereAs long as the functions are in different namespaces
14:10borkdudeAimHere right
14:10borkdudeppppaul a safer approach is maybe to use binding
14:10borkdude(defn my-find-id [] bla), (binding [find-id my-find-id] (some expr))
14:11gfredericks^:dynamic
14:11borkdudeppppaul yes, find-id has to be declared dynamic then
14:12ppppaulhmm
14:12ppppaulit's not dynamic and it's from someone else's lib
14:13hyPiRionjust fully qualify it, and require from your own ns
14:14bprborkdude, ppppaul: wouldn't technomancy's robbert hooke library be useful?
14:14borkdudebpr don't know it
14:15ppppaulwoah, this is getting too complicated for what i need... going to just call it by a different name
14:15bprhttps://github.com/technomancy/robert-hooke
14:16borkdudeppppaul that's an even better idea, use a different name
14:16borkdude=)
14:16borkdudebpr looks nice
14:16ppppaulrobert hooke is badass
14:44devnoh cemerick -- you've found a way to keep my sunday busy: https://gist.github.com/3e615a4d42b88ccefdb4
14:51devncemerick: oh...whoa. were you actively editing this when i mentioned it?
14:53devncemerick: nevermind. i think something is weird with github's "last updated at" thingy. it's saying last updated "just now", but no new revisions as far as i can tell
15:14technomancyis clojurescript-mode still useful now that we have piggieback? https://github.com/technomancy/clojure-mode/pull/118
15:16borkdudecomputable numbers are enumerable.. why, can someone explain it to me?
15:16borkdudebecause turing machines themselves are enumerable?
15:18hyPiRionBecause that's the definition?
15:18hyPiRionA set of computable numbers: There is an algorithm that enumerates its members.
15:19borkdudehyPiRion computable in the sense of: there is an algorithm that can compute the digits of the number to an arbitrary precision
15:19borkdudehyPiRion like 1/3, Pi, e, etc
15:20hyPiRionWell, yeah, theoretically
15:21hyPiRionIt's more in the lines of "repeating this algorithm forever yields π"
15:22hyPiRionIt's a property of the algorithm, not the turing machine.
15:22borkdudehyPiRion I want to have n digits of Pi, the digits are computable
15:26tomojRaynes: #'zip seems useful, but it also seems kind of silly in my case - maybe it would make more sense to have a select-locs or something?
15:26tomojor just make select always return locs... :/
15:27tomojactually, that probably wouldn't even work
15:35tomojyeah that seems to not work
15:37cemerickdevn: heh, that's pretty old at this point :-)
15:38tomojI've been pondering something like that the past couple days
15:40tomoja seq done like that could be traversed backwards with the reverse index, then you can layer on IIndexed
16:19tomojheh, I can backward slurp the repl prompt :/
16:40acronhi
16:41acronhttps://www.refheap.com/paste/7948
16:41acronWould some one mind taking a look at this?>
16:42acronI'm having a problem in which if a string with count < 4 is passed in,, an exception is thrown
16:42acronIt appears the "else" is resolved, even in the condition returns false
16:44tomoj(< 4 (count s)) is `4 < s.length`
16:44tomojI think you mean (< (count s) 4)
16:44tomojbtw, there is subs in clojure.core for .substring
16:45acrontomoj: gah, thanks - it is the count call messing it up
16:46acronahhh, so subs == .substring ?
16:46tomojyeah
16:46tomojI think you could also just write (defn is-op-str? [s] (.endsWith s "_op"))
16:47chouserincluding index out-of-bounds exceptions
16:47tomojfor which there is no non-interop equivalent
16:47tomojI'd think clojure.string would have starts-with? and ends-with?, but oh well
16:48hyPiRiontomoj: You got them from interop though, it's not really worth it wrapping them up
16:48tomojunless you're porting clj to cljs :)
16:48tomojplus, same argument applies to subs :P
16:48acronwhat would be the call via interop? i've not done any yet
16:49hyPiRion,(.startsWith "123" "12")
16:49clojurebottrue
16:49hyPiRion,(.startsWith "12143" "14")
16:49clojurebotfalse
16:49acronawesome.
16:49tomoj(.endsWith s "_op") above is 'interop', endsWith is a java method on String
16:50tomojhyPiRion: in addition, clojure.string could have {starts,ends}-with? work on CharSequence, like its {upper,lower}-case
16:51acrontomoj: afaik, clojure.string currently doesn't have starts-with or ends-with
16:51tomojindeed, that's why I'm complaining (when I should just be writing a patch..)
16:51acronis '.' short-hand for interop? Isn't it like (java.String.endsWith ...) ?
16:51hyPiRiontomoj: In fact, it could work on anything
16:51hyPiRionThat would be even better
16:51tomojI dunno
16:51hyPiRion(starts-with [1 2 3 4] [1 2])
16:51tomojwhoa, that is not what I thought you meant
16:52acronthat's an awesome idea
16:52tomojthought you meant (starts-with? [1 2 3 4] "[1 2")
16:52tomojI don't want either of those though
16:52hyPiRionDon't think it translates well to fast java interop
16:52tomojoh, I see, cus strings 'are' seqs
16:52tomojer, they are seqable
16:53hyPiRionyeah
16:53tomojyeah, I'd like clojure.string/starts-with? which is fast for strings
16:54tomojif you had a protocol for take, you could make a general starts-with? fast for ITake maybe, but that's crazy
16:55hyPiRionthere's much crazy in Clojure already :p
16:57chouserdoesn't sound crazy to me
16:58tomojwell, what should ITake's return value be, a seq?
16:58tomojit seems like it'd be cumbersome to implement all of IMap, IFilter, ITake, IDrop everywhere, like I was thinking
16:59chouseroh, perhaps I misunderstood
16:59hyPiRion,(ancestors clojure.lang.IPersistentVector)
16:59clojurebot#{clojure.lang.ILookup clojure.lang.Reversible clojure.lang.Associative clojure.lang.Seqable clojure.lang.IPersistentCollection ...}
16:59tomojabove I just meant (defprotocol ITake (-take [x])) where (= "f" (-take "foo" 1))
17:00tomojand (= '(1 2) (-take '(1 2 3) 2)), (= [1 2] (-take [1 2 3] 2))
17:01tomoj(apply a gricean maxim to get more information than is literally contained in those equalities..)
17:03tomojsay you have a cljs macro which does some weird global processing of the env, say it finds all implementations of a specific protocol and generates code based on that. in foo.weird, you call this weird macro at the top-level. now you may get different results for (:require foo.weird foo.bar) from (:require foo.bar foo.weird). what can we infer from this?
17:03tomojyou shouldn't write a weird macro like that? you shouldn't call it at the top-level?
17:03tomojyou can do that and tell people to be careful, without being burned at the stake?
17:04tomojone can also assume that the macro is idempotent, so that you can call it again in a new top-level to ensure you picked up all the protocol impls not seen before, and if there aren't any, it will generate no code
17:09tomojI feel like I want a hook that gets called every time a ns is required, even if it had already been required
17:10tomojwhich.. makes me uneasy
17:12acrontomoj, thanks again for your help
17:13acronall working now
17:15tomojthe goal would be to be able to say things like "find everything which implements IKVReduce and doesn't have an explicit IReduce impl. extend IReduce to those types with this impl that calls reduce-kv" (assuming you own IKVReduce, for politeness)
17:16tomojwith access to the env it should work even for (reify IKVReduce (-kv-reduce [coll f init] ...)), assuming that the ns which does that has already been analyzed
17:18tomojhmm.. that seems pretty damn weird though. probably couldn't work in clj either even if we had an analyzer like cljs's and the env was passed to macros
17:39tomojbbloom: what did you mean by "separate what from how"?
17:40bbloomtomoj: i mean that when you design with data, you build up some data structure that describes your problem and then you write an algorithm to solve that problem
17:40bbloomit's a good idea to figure out which bits are essential to the problem and which bits are incidental because of the way you choose to solve it
17:41tomojso specifically, it worries me a bit to jump straight to cards.dtm instead of cards.clj, since datomic seems "how"
17:41bbloomtomoj: don't jump straight to cards.dtm
17:42bbloomtomoj: the trick is continuous refactoring
17:42bbloombut when refactoring, you should figure out where to put your data
17:44bbloomtomoj: what i like to do is to start with trivial functions from the bottoms up that i know i'm gonna need. in your case, that would be stuff like "move this card from player 1 to player 2's hand"
17:45ibdknoxin this case I'm not sure I see the value in it being in datomic
17:45bbloomoh, yeah, i dunno why datomic is involved here haha
17:45bbloomthe entire game state is probably pretty small and could be in a single tree of maps, spit to file & you're good :-)
17:45ibdknoxI actually would argue that adds a fairly high amount of incidental complexity
17:45ppppauli want to add ns defs for all exposed vars from (use ns) in my ns... how can i do this?
17:45bbloomibdknox: absolutely
17:45tomojit certainly adds overhead
17:47ibdknoxppppaul: I don't follow
17:48ibdknoxppppaul: my shot in the dark would be something like potemkin: https://github.com/ztellman/potemkin
17:48ppppaulmy ns is getting a var (find-id) from some other ns. i want to be able to do my-ns/find-id
17:48tomojI want to be able to run queries like, say, "find all games in which a player bought exactly two joats, and get their score for each turn of that game"
17:48bbloomppppaul: i asked about this too, here's some discussion http://clojure-log.n01se.net/date/2012-12-25.html#16:31
17:49bbloomtomoj: i think you do that *later*
17:49bbloomtomoj: runtime data structures and query data structures are likely to be different
17:49bbloomso embrace that
17:49ibdknoxcard defs don't belong in datomic
17:50ibdknoxgame state could be stored there if you wanted
17:50bbloomalthough some card metadata can be in datomic if you wanted to query by it
17:50tomojI do, but that is admittedly a minor convenience
17:50ibdknoxbut I agree with bbloom do that later
17:50bbloomisolate components! write the runtime data structure
17:51bbloomand you can maintain a data structure of every step and the state at each step
17:51ibdknoxppppaul: import-fn in potemkin will do that I think
17:51bbloomand then when you want to query it, write a function that walks the data structure and flattens it into a datomic insert
17:51bbloommuch much simpler!
17:53ibdknoxwe should settle on a datalog impl
17:53ppppaulibdknox, thank you so much
17:53ibdknoxthen you could get the querying without the complexity of datomic
17:53ibdknoxfor things that aren't really database-y
17:53tomojwell, you can use datomic's datalog without using a database
17:53tomojbut you still have the dep
17:53ibdknoxppppaul: no problem dude
17:54tomojand I'm not hopeful they'll break out the datalog and release it
17:54ppppaulwhy do you care about the dep?
17:55tomojI feel my preferred representation for game state is a seq of datoms, but maybe I've just been staring at .dtm files for too long
17:55tomojwell, it pulls in a whole lot you don't need just for datalog. and logging and apache httpclient come to mind
17:55tomoje.g. pedantic complains if you ask for the latest datomic and latest clj-http
17:56bbloomtomoj: preferred for what task?
17:56ibdknoxso you can use the datalog stuff without some crossprocess nonsense?
17:56bbloomyou need different representations for different purposes
17:57ibdknoxi.e. without spinning up a database instance
17:57bbloomtomoj: did you watch http://www.infoq.com/presentations/Thinking-in-Data ? do like they did with their poker game!
17:58tomojibdknox: yeah, the query logic is 'client'-side. no transactor needed. and you don't even need an in-memory database, since the datalog bit works on regular clojure data structures as well
17:58bbloomafter the game is over, you can flatten facts about the game into datoms and query to your heart's content
17:58hiredman~ping
17:58clojurebotPONG!
17:58hyPiRion~gourds
17:58clojurebotSQUEEZE HIM!
17:59tomojthanks for the thoughts (bbloom: and the video)
17:59bbloomtomoj: the poker example is really good, it's actually extremely similar to dominion in terms of design approach
18:05bbloomthe Thinking In Data talk was particularly interesting to watch *after* i had already internalized all the same stuff he's saying. i found myself nodding my head like he was preaching gospel
18:18tomojhmm, consider outpost. if the game is an atom which we swap with state updates, we have to leave some history around in the state that says 'this turn is happening because of outpost' to know not to give them another turn if they play another outpost
18:19ppppaulibdknox, have you used potemkin?
18:19tomojI guess it's not really a problem to make the game state include the entire history
18:20ibdknoxppppaul: I have not. It's used throughout ztellman's stuff though
18:20bbloomtomoj: or you can store a flag on the current state
18:20bbloomand you have your choice of history representation
18:21ppppaulcrap. i'm running into a problem with it
18:21bbloomyou can trivially have a :previous-state key, and that's basically a linked list
18:21bbloomthat would give you O(N) access to prior states where N is number of states back in time to travel
18:22bbloomwhich is probably good enough
18:22tomojand I'd think N shouldn't ever be more than 1, though I will not be surprised when I am wrong
18:22bbloomso, if you're wrong, you change it :-P
18:22bbloomthink about the types of operations you need to perform
18:22bbloomdesign a data structure for that
18:23bbloomthen, figure out which bits are "essential" and which bits are just cached values for convenience & performance of later algorithms
18:23bbloomthe ultimate essence of the game is just a list of actions taken. you can serialize games as a vector of action maps
18:24bbloombut at runtime, you might want [:outpost-played true] in your map for convenience
18:24bbloomif each game state has an :action key which is the most recent action, you can trivially produce the game history by reduction
18:25bbloomyou create a 'history function which returns a sequence of game states in reverse cronological order
18:25bbloomthen you (reduce (fn [actions state] (conj log (:action state))) [] (history state))
18:26bbloomand then you have a nice little vector of actions, spit to a file, poof you're done
18:26bbloomlove it.
18:26ogrimAnyone compiled Clojure CLR for .NET 4.5?
18:26bbloomthe history function is just a lazy-seq recursive walk down into :previous-state keys
18:28bbloomtomoj: does that make sense?
18:30tomojyeah
18:31bbloomso this is what i mean by what vs how: you need to work at it from both angels
18:31bbloomin this case, the "what" is the sequence of actions
18:31bbloomthe how is the structure you're using at runtime to power the particular functions you need to make the next game state from a given action
18:32bbloomyou gotta come at the problem from both sides :-)
18:32tomoj"find all turns (in any game) in which a player could have played an outpost to get an extra turn, but didn't". we could write a query function that builds up a game state map from all the recorded datoms up to a point, then one which applies the datomic-less game logic to that. worries me some performance-wise, but I'll ignore that concern for now
18:33bbloomtomoj: that's one strategy
18:33amalloybbloom: uh, isn't that reduce just (map :action (history state))?
18:34bbloomamalloy: lol duuuh that's what i get for writing code in my irc window
18:34tomojanother that occurred to me would be to record as datoms all the available choices a player had
18:34bbloomtomoj: classic time vs space tradeoff
18:35bbloomif it's taking too much time, figure out a way to trade time for space :-)
18:35tomojbut when someone gets a 20-card hand and plays chapel.. :)
18:35bbloomstart with the essence of the problem, trade off space and time later :-)
18:35tomojyeah, again thanks
18:35bbloommy pleasure
18:35bbloomexplaining this stuff helps me think about it too
18:40tomojs/chapel/cellar/
18:43bbloomtomoj: it's ok, i haven't played dominion in years, so i have no idea which cards are which :-)
18:44RaynesI like Dominion, but it really gets tedious when you have more than 1 expansion.
18:44tomojcellar with 20 other cards in hand is 2^20 choices
18:44RaynesI'm not a huge fan of games that take longer to set up and clean up than they do to play.
18:44bbloomand there's always that one guy who has played so many times that he knows exactly what strategy to use for any permutation of cards, such that his turns are longer than everyone else's combined times 10
18:44RaynesRisk is an exception to that rule, I guess.
18:45bbloomRaynes: may i suggest http://www.gilwood.org/riskopoly.htm
18:46bbloomwarning: allocate an entire evening to riskopoly if your friends are the types of negotiate really strange treaties before the UN (simple majority to enact new rules)
18:46bbloomgood luck programming that game....
18:46tomojRaynes: that's what isotropic is for
18:46tomojin my play group everyone was like "waah I don't want to play online, we're in the same room, that's stupid, let's just play IRL". I convinced them and we haven't touched our real cards again since
18:48Raynestomoj: So, I realized my implementation of descendant-of was entirely broken and rewrote it earlier. It was pretty funny. It only worked by accident with my specific test cases.
18:48tomojhuh, seems to have worked ok for me so far too
18:48tomojoh, I already have that commit
18:49RaynesYeah, if you're using the version I wrote last night, it's only working by accident.
18:49tomojoh, the version that "actually works" doesn't?
18:49RaynesNo, the version I wrote *last night*. I wrote a new version 4 hours ago.
18:50tomojah :)
18:50tomojthere is a phantom node now too
18:50RaynesThis new version should work fine. it's unfortunately larger and has the strangest reduce I've ever written, but it should work.
18:50tomojphantom #'node
18:50RaynesI fixed that.
18:51RaynesProbably didn't push.
18:51RaynesJust pushed.
18:51tomojoh, yes, I see it :)
18:51RaynesYou can be confident that if laser ever got as big as Enlive, at least 200-300 lines of it would be phantom functions.
18:51tomojI weakly suggest (defn select1 [zip & selectors] (first (apply select zip selectors)))
18:52tomojkind of seems silly now that I say it out loud
18:52RaynesI can't imagine why you'd want that. :o
18:53RaynesSince it's just (first (select …))
18:53tomojyeah, hence "silly"
18:53RaynesYou rarely say silly things though.
18:53tomojit was by analogy to xml1->
18:55RaynesI'm going to try to generalize the code in descendant-of later, since the code for arbitary args in each of these combinators should be very similar.
18:55RaynesBut for now… cheeseburger.
18:58bbloomlol
19:15pcsanwaldhi everyone, I'm paul. I'm new to #clojure and haven't used irc for a very very long time
19:15tpopehi paul
19:16pcsanwaldsomeone at the nyc clojure meetup mentioned #clojure, so I figured I'd drop in. sorry for the AA style introduction :)
19:17ppppauli'm also paul
19:17seangrovepcsanwald: No one can get better at fp unless they admit to a belief in a higher bbloom
19:17ppppaulany other pauls?
19:17tpopehi also paul
19:17pcsanwaldexcellent. solid name.
19:18amalloyi guess ohpauleeze doesn't hang out in here anymore
19:19bbloomseangrove: hey man, i'm just a bishop, hickey's the pope
19:19bbloomhell, i'm not even a bishop
19:19seangrovebbloom: How's the CPS transformer coming along?
19:19bbloomseangrove: it's not
19:20ppppaulfp puts the fun in functional
19:20bbloomseangrove: it's a pretty low priority task on my list
19:20seangroveHeh, no worries
19:20seangroveJust curious
19:20bbloomseangrove: and it's *hard* so i need somebody to help me with it. im hoping dnolen and i can hack on it when i get to NYC
19:20bprbbloom: i'd say hickey's closer to the buddah lol... the pope comes with too much cerimony :-p
19:21bbloomseangrove: my other projects are coming along splendidly, however :-)
19:21seangroveHeh, let me know if you come down to SF sometime, wouldn't mind hacking on something with you
19:21tomojditto
19:21bbloomseangrove: yeah absolutely. i'm usually in SF a few times a year
19:22seangroveGood stuff
19:22bbloomi need a good way to keep track of which people are in which cities so i know who to ping when i visit
19:25chouserbbloom: https://maps.google.com/maps/ms?ie=UTF8&amp;oe=UTF8&amp;msa=0&amp;msid=112691912540601337884.00045972a1deb8de0d96b
19:26bbloomchouser: awesome.
19:27bbloomi don't have an address in NY yet, i should just put a pin on liberty island
19:27chouserThere's a remote possibility that clojure users exist that are not on that map.
19:28bbloomunderstatement of the year
19:28bbloomi'm laying claim to the reservoir in central park
19:28pcsanwaldbbloom you are moving to nyc?
19:28bbloomyup
19:28winkhehe, no one from the Munich Clojure UG on that map
19:30chouserbbloom: are you moving there just for the Clojure users group?
19:30pcsanwaldnice, welcome. get ready for every single NYer you meet to tell you how awesome their neighborhood is
19:30seancorfielddid i miss a link to a clojure users' map?
19:31chouserseancorfield: The last link pasted. It's a very old map -- I'm surprised people have continued to add to it.
19:31bbloomchouser: i'm in seattle now and i'm originally from NY, my family is all there. starting my next company there
19:32chouserCreated on Oct 17, 2008
19:32bbloombut the clojure community is a nice bonus
19:38ferdhey... just added myself. First one in Argentina :-\
19:41chouserI don't see you. Did you click save?
19:41seancorfieldchouser: i guess it was posted before i (re)joined the channel
19:41ferdchouser: yes
19:41chouserseancorfield: https://maps.google.com/maps/ms?ie=UTF8&amp;oe=UTF8&amp;msa=0&amp;msid=112691912540601337884.00045972a1deb8de0d96b
19:45ferdchouser: I don't see it from another browser session :-\ not sure what else I need to do
19:46bbloomi think there's some eventually consistency involved
19:46bbloommy understanding from talking to a gmaps engineer is that bike trail edits are updated within 20 minutes, so i'd imagine comparable turnarounds
19:47bbloomi think all the geo-indexing happens on the spiritual equivalent of a gigantic cron job
19:48chouseroh, I think there are two pages of markers
19:48bbloomoh, boo
19:48chouserscroll the left panel all the way to the bottom, click next, get a completely different set of markers
19:48bbloomthat sucks
19:49chouserAnd look, there's someone in Buenos Aires!
19:49bbloomgoogle maps supports marker clustering: https://developers.google.com/maps/articles/toomanymarkers
19:49bbloomthey should use it here :-)
19:50ferdhey!
19:50bbloomgood example of this in action: http://mappedinny.com/
19:52tomojI parsed that domain as something about belly buttons
19:52ivanwow, that page 1/2 thing is horrible
19:55ivanafter switching a couple times, all the markers are gone, heh
19:56seancorfieldhmm, finally got java.jdbc passing all its tests again... maybe i should quit while i'm ahead?
19:58seancorfieldpart of the big refactor to add an API where you pass in the db spec instead of using *db* - and then rewriting all the old API in terms of the new one
19:59chouserseancorfield: excellent. That's an important improvement.
19:59ferdI'm trying 'cemerick/friend with http-basic authentication. Works fine... however, when client sends no credentials, it's responding with a redirect (HTTP 302) ... I want it to fail (HTTP 401). Ideas?
19:59seancorfieldfor example (execute! db-spec [sql-string param1 param2] :transaction? true)
20:01seancorfieldand simpler (query db-spec [sql-string param1 param2]) to just return a result set fully realized
20:04ferd...hmm looks like the redirection logic is not part of the http-basic "workflow"... it's "hardcoded" within the authentication* function. I'm afraid I won't be able to achieve this without touching friends/authenticate*
20:07ferdcemerick: I'd appreciate you ideas. And thanks a lot for your work. Good stuff
20:07tpopeferd: :workflows [(workflows/http-basic)]
20:07ferdyes, that's what I'm doing
20:08tpopehmm, it's giving me a 401 just fine
20:08ferdwhat if you don't pass any creds ?
20:08tpope401
20:08ferdhmm... I get 302 redirecting to /login
20:09tpopeferd: just walked through by hand and ended up at https://github.com/cemerick/friend/blob/master/src/cemerick/friend/workflows.clj#L7-11
20:15ferdI don't know what code path it's taking... but it's redirecting me back to /login
20:24ferdtpope: cannot get around it :-(. Thanks anyway. I'll continue tomorrow
20:25tpopeferd: my guess is you have some other call friend/authenticate you're forgetting about
20:26ferdtpope: nope :-( ... I re-started my nrepl session in case I had another handler in place that I wasn't seeing... but no luck
20:30ferdwhen I say I don't pass credentials, I mean I pass nothing at all .. that is, no "Authentication:" HTTP header going on the request (using curl here, I simply don't pass the --user parameter to it)
20:31tpope (let [response (app (request :get "/"))] (is (= (:status response) 401))))
20:31tpopethat's from my test suite
20:31tpopeno auth headers there
20:32tpopejust double checked with curl
20:33ferdwell... good to know it works for somebody... I'll get back at it tomorrow with a fresh view
20:33ferdversion of friend ? "0.1.2" ?
20:33tpope0.1.2
20:33ferdthanks. leaving for the day
20:43DeeceIs anyone proficient with vim-foreplay? I'm trying to connect to my repl server but it seems to fail.
20:44tpopeI've played with it
20:44chouserheh
20:44Rich_Morin:)
20:44tpopedefine "seems to fail"
20:46DeeceSorry. After entering localhost and the port via the interactive :Connect, I get "nREPL: execution expired" after it blocks for a while, and I see a java.net.SocketException show up in the REPL i've got running in another window.
20:47tpopeoh boy
20:48DeeceTo start with, it looks like I'm not even running lein2 - was using an old arch package. i'll try that ;o
20:48tpopeI hope that's it
20:48tpopebecause walking you through debugging this is going to be super tedious
20:50Deecethat was indeed it. phew, thanks.
20:50tpopewhat was the old version of lein?
20:51tpopeif I can reproduce it locally then maybe future Deeces can be spared this problem
20:51tpopeDeece: ^
20:51Deece1.7-1-1 - https://aur.archlinux.org/packages/lein/
20:55tpopeindeed, I can reproduce it
21:06bosiewhat would be a good way to transform a list to a map containing the occurences as values
21:07bosiei only have a convoluted way by filtering the list and applying count on it
21:08ibdknox,(doc frequencies)
21:08clojurebot"([coll]); Returns a map from distinct items in coll to the number of times they appear."
21:08ibdknoxbosie: ^
21:08bosieibdknox: thats cheating
21:08bosie;)
21:09ibdknoxreduce and update-in would be the best manual solution I can think of
21:09bosieok, have to look at those, as i didn't use that at all. thanks
21:10amalloyreduce, update-in, and fnil
21:10ibdknox,(doc fnil)
21:10clojurebot"([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."
21:10tpopeDeece: whoa, looks like lein 1.7 doesn't use nrepl at all
21:10ibdknoxtpope: that was new in 2.0
21:10amalloyor a shorter solution is (apply merge-with + (for [x coll] {x 1}))
21:11ibdknoxhaha nice
21:11seancorfieldthat is nice, amalloy !
21:11amalloynot my own invention, i'm afraid. that's stolen from someone's 4clojure solution ages ago
21:12bosiewouldn't that run in n^2 ?
21:12bosiehmm or not, since its all lazy... hm
21:13amalloyeven if it weren't lazy i can't imagine it taking n^2
21:13amalloymaybe 2n, but of course that's just n
21:13bosieamalloy: oh, the (for...) runs once?
21:13amalloyuhh...?
21:14bosiei am not quite sure how clojure evaluates the whole term?
21:15bosieit goes to th for part, looks at the first item of coll, creates {x 1}, passes it into merge-with and applies + on it. goes to the second item of coll and so forth?
21:15tpopeibdknox: good to know. but annoying to guard against :/
21:16seancorfieldbosie: are you asking about how the laziness works? or about order of eval in general?
21:16bosieseancorfield: both i guess
21:17seancorfieldwithout laziness, (for ..) would produce a sequence, then apply would use that as the arglist for merge-with
21:17seancorfieldwith laziness, yes, it's more complicated :)
21:17seancorfieldi can't remember exactly how apply interacts with laziness like that
21:17ibdknoxseancorfield: what size shirt do you wear? :)
21:18seancorfieldgenerally 2XL ibdknox
21:18seancorfieldi have my LT T sitting right next to me atm...
21:18seancorfieldit hasn't made it out of the office, into the bedroom
21:18ibdknoxah, you got one through the KS already?
21:19seancorfieldyup! very nice, thanx!
21:19amalloyseancorfield: it works fine with laziness. merge-with takes its arglist as a seq named 'ms, or something like that. if that seq is lazy, no big deal
21:19seancorfieldamalloy: yeah, i know "it works fine" but i
21:20seancorfieldi'm not 100% clear on how apply actually causes a lazy seq to be realized as an arglist
21:20bosieamalloy: could you elaborate what "no big deal" means with lazy eval?
21:20seancorfielddoes it depend on the definition of the function being applied?
21:20bosieamalloy: is my above description correct?
21:21amalloyseancorfield: IFn (or maybe RestFn?) includes an (.applyTo this args) method, which takes a sequence. (fn [& args] ...) turns into an implementation of that interface that just accepts the arglist and does whatever with it
21:24seancorfieldamalloy: 'k... i added println to the fn used for merging and the for seq, and all the for seq was realized first, then the adds were done for the duped items... but i may not have used a long enough seq to really see any interleaving
21:25seancorfieldok, with a large enough seq (> 32 items) the for and the add start to interleave
21:26bosieseancorfield: mind sharing the code?
21:26seancorfieldbosie: https://www.refheap.com/paste/7959
21:26seancorfieldshows the code and the output and the result
21:29seancorfieldoutta here for the night...
21:29bosieseanaway: thx
21:30bosiealthough i see no + ;)
21:30bosienvm
21:31bosiewhy would i see no + here https://www.refheap.com/paste/7960 ?
21:32bosieoh
21:32bosienvm
22:08seangroveRaynes: <3 refheap
22:08seangroveI'm having trouble with a function calling back to itself via setTimeout in cljs: https://www.refheap.com/paste/7961
22:09seangroveIt runs fine the first time, but it's not able to call itself back
22:09tufflaxtomoj, I figured out the future thing :p
22:09seangroveIt seels like _wait-for-selector is being expanded to the full namespace, so I'm getting "WARNING: Use of undeclared Var zenbox.client.gmail.sidebar/_wait-for-selector"
22:10seangroveHere's the javascript I'm porting to cljs: https://www.refheap.com/paste/2eea95111c2269931432ce044
22:11tomojseangrove: hmm.. try it without the initial underscore?
22:11tomojsay, use wait-for-selector*
22:11tufflaxtomoj, it was stupid really: I used a with-open to open `in` and then spawned a future, but closed the stream immediately :p
22:12seangrovetomoj: Same problem
22:12tomojoh
22:12tomojI didn't notice the other use
22:13tomojlet doesn't work that way
22:13tomojyou could use letfn probably
22:13seangroveOk, let me look at letfn
22:13seangroveWas wondering if let bindings could refer to themselves
22:13tomojeasier way incoming
22:14tomojsomething like this should work: https://www.refheap.com/paste/ef8b1948825cb8f7bbe430ec9
22:14Raynesseangrove: <3
22:15seangrovetomoj: The javascript on that one does look better, yes
22:16seangroveAnd yes, it works, thanks :)
22:19tomojI guess 'wait is not a good name
22:20aaelonysomehow I'm getting stuck dealing with a clojure collection with nestings where I want to output keys as xml tags and values as xml content (no xml attributes). is clojure.walk/postwalk the way to go? Unsure how to configure it with a case statement that determines the type at each node… https://www.refheap.com/paste/7963
22:21aaelonyI don't want the :tag, :attrs, and :content in clojure.xml
22:21DeeceI've almost got everything working nicely with vim-foreplay, except that my leiningen (2.0.0) isn't writing the target/repl-port file when i start up the repl. Anyone know what to do?
22:22aaelonyor maybe i do...
22:25aaelonyor rather, the way hiccup does it
22:30tufflaxaaelony, where are you stuck?
22:31aaelonybasically, on two levels. First the nestings. if a node is terminal (a number or a string) then that's fine, but if it isn't it needs to handle based on type
22:32aaelonysecondly, i'm unsure whether i need hiccup, clojure.xml, clojure.walk, or even just seq
22:32aaelony(seq {:foo 1 :bar 2}) almost does what i want
22:33aaelonybut needs "something" for (seq {:foo 1 :bar 2 :baz {:a 1 :b 2}})
22:34tufflaxHm, your "what I want" in the paste can be done with postwalk I think
22:35aaelonyi think postwalk will be most elegant, but I am trying to understand it better
22:36aaelonythen a simple change to (walk/postwalk #(do (println "visiting:" %) %) x) would do it
22:37aaelonytufflax: i'll study http://clojuredocs.org/clojure_core/1.2.0/clojure.walk/postwalk a bit more...
22:53aaelonytufflax: postwalk works pretty well for the descent (open tags) and terminal nodes, but I am unsure how to close out the tags on the way back up.
23:03tufflaxaaelony, https://www.refheap.com/paste/7965 maybe something like that?
23:04aaelonytufflax: yes that is it
23:04aaelonyperhaps postwalk-replace would work too but I am unsure how it works
23:05tufflaxI tried with postwalk but it was a mess :p
23:06aaelonywill study your solution, thanks. I'll add postwalk to the list of things to figure out :)
23:06tufflax:)
23:06tufflaxjust ask if you don't understand :p
23:07aaelonyI also have vectors in there but I should be able to tweak further from what you have :)
23:07aaelonythanks tufflax :)
23:07tufflaxwhat do you want to happen to the vectors?
23:08tufflaxaaelony
23:09aaelony{:a [ {:line "blah"} {:line "blah2"}] }should become <a><line>blah</line><line>blah2</line></a>
23:09aaelonyi think i can wrangle that further though from there
23:10aaelonysometimes the xml needs to preserver order, so vectors...
23:10aaelonypreserve
23:10tufflaxaaelony, that's what my code does, with the vectors
23:10tufflax<a><line>blah</line><line>blah2</line></a> is the output :P
23:11aaelonynice
23:11aaelonywhy (str (str btw?
23:11aaelonyanyways, thx again.. will tinker with it
23:12tufflaxaaelony, for clarity, if you indent correcly it looks nicer, but the indentation in my paste was not correct
23:12aaelonyi see
23:13dcbIs there anything like flip http://hackage.haskell.org/packages/archive/base/latest/doc/html/Prelude.html#v:flip in clojure? I am trying to needing it because I want to use threading, but the arg order is not consistent
23:15tufflaxdcb I don't think so, but of course it's very easy to make one :p
23:16dcbtufflax: Indeed, thanks
23:18dcbwould it be considered bad or non-idiomatic to make a single arg anonymous function in the threading sequence to get around the ordering issue?
23:19tufflaxdcb hm, I don't know, example?
23:19dcbas in: (-> some-string (s/split-lines) #(map some-func %))
23:20dcbactually that doesn't really make sense because ->> would work with split-lines
23:20dcbbut imagine if split-lines had to take some-string as the first arg
23:20tufflaxyeah, also, #() functions don't work so well with the threading macros
23:20tomojit would need to be (-> some-string (s/split-lines) (#(map some-func %)))
23:21dcbtufflax, tomoj: ah. ok. I'll just keep it simple then
23:21tomojI just don't use threading when it doesn't work. I dunno that it's that bad to do (-> ... (#(foo %)))
23:21dcbtomoj: yah. just kind of ugly
23:21tomojmaybe you should check out the new threading macros in 1.5, maybe one will help
23:22tufflaxdcb I would not consider it to be idiomatic, if there the list of functions is long, and only 1 needs #() i would do it
23:22tomoj(1.5.0-RC1 to be precise)
23:22tufflaxer, non-idiomatic
23:23dcbOK, thanks
23:23tufflaxwhy did test-> become cond->? :P I think test-> was a better name :p
23:23tufflax(because it did, right?)
23:23tufflaxs/because//
23:24Raynesdcb: flip wont do what you want anyways.
23:24Raynesdcb: (-> x (flip a y)) = (flip x a y)
23:24RaynesIt works with raw lists, not functions.
23:25tufflaxRaynes, hm, flip would be called (flip map) for example...
23:25RaynesAh, right, I suppose. I was conflating it with partial as well.
23:25RaynesBut still, meh.
23:26RaynesIf you need to do argument flipping and such just for threading, I'd just not use threading.
23:26dcbRaynes: no, your right. It makes sense to do in haskell because of the currying
23:26dcband threading is not currying. hmmm....
23:27RaynesI squeal in glee when I see flip in a point free Haskell expression.
23:28dcbRaynes: haha, it can be really nice in certain circumstances
23:30tomoj;; (-> x ((flip f)))
23:31tomojwell that would be silly :)
23:32dcb,(-> :a (partial flip {:a :b}))
23:32clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: flip in this context, compiling:(NO_SOURCE_PATH:0)>
23:32dcbhah oh yah
23:32tomojit would be (-> x ((flip (fn [y x] ...)) y)) I guess
23:32tomoj(which is still silly, as already noted)
23:33dcbquite
23:43muhoois the :repl profile supposed to automatically activate whenever running a repl?
23:51muhoohaving a :repl profile at all in my profiles.clj causes lein trampoline repl to fail completely: Could not locate clojure/tools/nrepl/server__init.class or clojure/tools/nrepl/server.clj on classpath
23:51muhooauugh, wait, i need to build lein from master, and that was failing for a different reason. :-/
23:56muhoook, fine. same failure with lein built from master.
23:56muhoocan't find nrepl. have no idea why.