#clojure logs

2011-04-19

00:17choffsteinanyone know why I might be getting this error: java.lang.Exception: Unable to find static field: parseDouble in class java.lang.Double
00:17choffsteinseems ... strange
00:17amalloyyou're trying to call parseDouble with no arguments, and the compiler's best guess is that maybe it's a field
00:18amalloy&(Double/parseDouble)
00:18sexpbotjava.lang.NoSuchFieldException: parseDouble
00:18amalloy&(. Double (parseDouble))
00:18sexpbotjava.lang.IllegalArgumentException: No matching method: parseDouble
00:18choffsteinAh. So I can't do something like map Double/parseDouble
00:19amalloy^ is how you could force it to act like a method, if there actually were a no-arg version
00:19choffsteinbut should do map #(Double/parseDouble %)
00:19amalloychoffstein: no. methods are not first-class functions; they require wrappers
00:19amalloyexactly
00:19choffsteinthanks :)
00:29tomojbeautification tips? https://gist.github.com/5b709e90dbb330d1fb62
00:29amalloywhee i love this kind of assignment
00:30tomojthe idea is to go through each x in s until you get the same (f x) n times
00:30tomojthen return any such x (my implementation returns the first iirc)
00:30amalloytomoj: seems like you should use partition-by
00:31tomojaha
00:31tomojthen (first (filter #(= (count %) n) ...)) ?
00:31amalloyright
00:31amalloywell
00:31tomojshoot
00:31amalloy>, not =
00:31tomojd'oh
00:31tomojthanks!
00:32tomojI don't even understand that nasty stuff I wrote
00:33tomojgist updated, beautification achieved
00:34tomojexcept, oshit, ffirst
00:34tomojI don't think I've ever used any of those
00:34amalloytomoj: i know, i was excited to suggest ffirst
00:34amalloybut then you went and took the fucking idea before i could finish typing it
00:34tomojwait
00:34tomojthis doesn't work, though
00:35tomojI remember considering some function and giving up for this problem, but I don't think it was partition-by
00:35amalloytomoj: you have your <= written backward, i think. happens to me all the damn time
00:35tomojproblem is the seq might be infinite
00:35amalloyso?
00:36tomojpartition-by chokes on (repeat 1)
00:36amalloypartition-by is lazy, isn't it?
00:36amalloyoh, i see
00:36tomojlazy in partitions, not in each partition
00:36amalloyif a given partition is infinite, yes
00:37tomojthe real point is to approximately find the value (iterate f other-s) converges on
00:37tomojif n is big enough the last partition actually will be infinite because you really will have found the convergence
00:38amalloytomoj: perhaps (map f the-collection), then (partition n 1) to get it into chunks of the right size
00:38tomojoh, but I think can just use the ugly trick in my first version with this one?
00:38amalloythen you can check each chunk to see if they're identical
00:38amalloytomoj: i didn't even read the first version :P
00:39tomojnope, doesn't work :(
00:39tomojmy ugly trick I mean
00:40tomoj(partition n 1) sounds prettier than what I've got but intuitively much slower
00:40tomojsince I said that I guess I have to test it
00:41amalloycertainly if your data is AAABBBAAABBBAAAA and N is 4 it won't be that great
00:41amalloybut it seems like a pretty small difference
00:43tomojhmm, tried something like that, but it returns (f x) instead of x
00:43amalloytomoj: (map (juxt identity f) ...)
00:45tomojeww https://gist.github.com/d37cc1b6a4855cce3581
00:46tomojamalloy: what did you call it?
00:46amalloydecorate
00:46amalloyi also wrote a version that immediately applies the juxted function: annotate
00:46tomojI think I've wanted at least one of those before
00:47amalloytomoj: ask and ye shall receive. just depend on amalloy/utils
00:48amalloyalso the (comp) stuff there looks like a mess. why not just (filter (comp (partial apply =) (partial map first)))?
00:51tomoj:)
00:56tomojonly a bit slower than my version, at least including the actual work I'm doing
00:58tomojeven with my work cut out it's only 22% slower
00:58tomojand this certainly won't be the bottleneck. thanks
01:02amalloywelcome
01:04seancorfield__every time someone mentions juxt i have to go and look up what it does
01:05seancorfield__and i always see "Alpha - name subject to change" and wish it was dist or distribute because then i'd know what it did :)
01:06amalloyseancorfield__: i'd never know, if it were called one of those :P
01:07amalloyjuxt is so memorable and unique, as a name, that it sticks in my mind. and it *juxt*aposes (f x) with (g x)
01:07seancorfield__one man's obvious is another man's wtf? :)
01:08amalloyheh, indeed
01:09brehautseancorfield: in haskell its called (&&&)
01:09brehautand it has a related (***)
01:09brehauti can never remember which is which
01:13seancorfield__instead of "more cowbell" it looks like "more punctuation"...
01:13tomojwonder how they pronounce them
01:13tomojI vote "triple-{amp,star}"
01:14brehauttomoj: haskell programmers dont talk to each other, they just share publish papers
01:14tomoj:D
01:14tomojconal's talk where he says that some category-theoretical properties of his types makes him feel like he's got the right abstraction still leaves me a bit awestruck
01:15brehauthah
01:15brehauttomoj: seen patternsinfp.wordpress.com/ ?
01:17tomojdiagrams like that are a sign to me that I'm in over my head
01:17brehaut:)
01:18tomoj"coalgebras for the costate comonad" FUCK
01:18brehautim pretty sure they are category theory stuff
01:18tomojI've tried reading the rosetta stone at least several times and given up
01:19brehautback when i was a postgrad i had this guy lecturing us on this stuff (he was a visiting lecturer)
01:19brehauti dont think i could have been less prepared for that class
01:32amalloy$findfn " " "+"
01:32sexpbot[]
01:32amalloywhere do we have url-encoding?
01:36brehautamalloy: https://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/util/codec.clj ?
01:36brehautuses java.net.URLEncoder
01:36amalloyyeah, i guess
01:36amalloyfeh
01:37amalloybuilding clojure wrappers for everything is silly, but if there's something *i* want without a clojure wrapper that's a bug
01:46tomojI'm still waiting for someone to write a clojure thrift impl
01:47znutarIs there some order in which you should install paredit, clojure-mode and swank-clojure in emacs? The 3 times I've tried it on different boxes different things seem to be broken.
01:47tomojbut I guess I'm the only one crazy enough to think that's a good idea
01:47tomojdon't install swank-clojure ever :P
01:47znutarBut if I do that it works!
01:47tomojit's deprecated
01:48znutarThis explains a lot.
01:48tomojinstead you should start a swank server with lein or cake, no swank-clojure.el needed to connect
01:48tomojyou also need a newer version of paredit than is in the standard elpa repo
01:49tomojI use http://mumble.net/~campbell/emacs/paredit-beta.el but I think (my memory is foggy) there may be a special clojurista's version floating around somewhere?
01:49znutarIs the marmalade-pointing current emacs starter kit version workable?
01:49tomojthe clojure-mode in there should be good, what version of paredit is it?
01:50tomoj21 or greater should be OK
01:50znutarI think it was 22... it's stopped responding since I deleted swank-clojure though
01:51tomoj.. paredit has stopped responding?
01:52znutaremacs in its entirety has
01:52tomojdoes C-g save?
01:53znutarNo, went ahead and kill -9'ed it
01:53tomojouch
01:53znutarNo big deal, I'm just fooling around with my old .emacs saved off somewhere
01:53znutarWhat were you doing with thrift, btw?
01:54tomojfor a while I'd hoped to get my team to use it, if only to force some thought into shared data/service design
01:54tomojand the idea of implementing it with gloss/aleph is still attractive, even if this would end up being a highly nonstandard implementation
01:55tomojand with ztellman's promise of amqp in aleph, txamqp looks more tenable
01:55znutarIt seems to be lovely for its purpose, although I've barely used it personally.
01:56tomojI think most of the implementations are crappy
01:56tomojI couldn't find one that properly handled the seqid for instance
01:57tomojif the clojure proto library wasn't so tied to cake I'd jump to protobufs with no hesitation
02:00tomojholy shit, apt-get install maven2 says it wants to install 121 extra pacakages
02:02seancorfield__heh, i just did mvn test on a new system and it downloaded the entire internet!
02:02znutarwow, the java thrift generates is a LOT uglier than the c++ equivalent it generates.
02:03seancorfield__that's just because it's java :)
02:03tomojmy idea was that a clojure impl could just generate some pretty macro calls
02:03tomojthen the accompanying clojure library could do all the hard work by defining the macros
02:03tomojmaybe I liked this idea just so that I wouldn't have to muck around in C much
02:57abadrreading the Joy of Clojure, it gives (1 2 3 4) as an example of a list, but this produces an error for me on the repl -- I'm guessing because 1 isn't a "function, macro, or special form". what's the story?
02:59seancorfield__'(1 2 3 4)
03:00thorwil^ quote it like that, so clojure doesn't try to evaluate it
03:00seancorfield__,'(1 2 3 4)
03:00clojurebot(1 2 3 4)
03:00seancorfield__,[1 2 3 4]
03:00clojurebot[1 2 3 4]
03:00abadri see, thanks
03:00seancorfield__,(map inc '(1 2 3 4))
03:00clojurebot(2 3 4 5)
03:01seancorfield__,(map inc [1 2 3 4])
03:01clojurebot(2 3 4 5)
03:01seancorfield__,(list 1 2 3 4)
03:01clojurebot(1 2 3 4)
03:01seancorfield__hth
03:01abadrit does :)
03:02seancorfield__time for me to turn into a pumpkin... gotta be up early to get my CNG-powered car in for a service :(
03:24markomannow my function got so ugly I need your help
03:27markomanbasically im trying to do: (assoc-in map [:args] (do (some-side-effect) {})))
03:28amalloymarkoman: it sounds like you're mixing mutability and functional code a little too closely for comfort here. but style aside, your code seems like it should work?
03:29markomanyes, I need to update session information on function and return a map at the same time
03:30markomanim confuced because updating session is a function call and it returns something, that I dont need. instead after update I continue creating map
03:32markomanso what happens to assoc-in map when do gives nil and {}. it the last one returned or?
03:40amalloymarkoman: surely this would be easier to try in your repl than wait around for help on irc
03:45markomanconnection broke so...
03:46markoman,(assoc-in {:args {}} [:args] (do nil {:k 1}))
03:46clojurebot{:args {:k 1}}
03:46markoman,(assoc-in {:args {}} [:args] (do (println "side effects") {:k 1}))
03:46clojurebotside effects
03:46clojurebot{:args {:k 1}}
03:47Fossimarkoman: you can message clojurebot in private as well
03:47Fossior just start a repl ;)
03:48markomanoh im doing it too, just continue discussion. but how do you message bot private?
03:48markomanI got that, clicking the name gave private chat
03:48Fossidepends on your client
03:51markomank, added clojurebot to my buddy list, best friends, lol
05:12markomanhow do you check if nested vector has keywords: [[:a {}][:b {}][:c 1]] [:a :b] any of these
05:14markomantrue or false
05:14ejackson,(map coll? [:a :b :c])
05:14clojurebot(false false false)
05:15ejackson,(and (map coll? [:a :b :c]))
05:15clojurebot(false false false)
05:17ejacksoni'm trying to figure out the opposite of every?
05:18ejacksonsome !
05:18ejackson,(some coll? [:a :b :c])
05:18clojurebotnil
05:19ejackson,(some coll? [:a [:b] :c])
05:19clojurebottrue
05:19ejacksonmarkoman: ^^^
05:19ejacksonoh wait.... i answered the wrong question.... where's my coffee gone
05:20ejacksonmarkoman: you're going to have trouble pulling the keys and vals apart
05:20markomanwell I learned some and coll? anyway :)
05:21ejacksonif not for that I'd suggest (some coll? (flatten x))
05:22markomanyes! flatten makes it close
05:23markomanbut now i need to compare
05:24markomanif (flatten [[:a {}][:b {}][:c 1]]) has any of these keys [:a :b]
05:24fliebelDoes anyone know a Java lib that can play ALAC? It's rarely used outside of Mac, so most of those cross-platformy things don't play it. About anything that deals with audio in Mac plays it, but that's all C and most of it Objective C.
05:37Chousukemarkoman: try (some #{:a :b} [:c :d :b])
05:40markomanthat works: (some #{:q :b} (keys (into {} [[:a {}][:b {}][:c 1]])))
05:43raek(some #{:q :b} (map first [[:a {}] [:b {}] [:c 1]]))
05:44raekmarkoman: any particular reason you have a vector of vectors and not a map?
05:46markomanhmh, maybe not. i was thinking i could add some additional "params" like [:a {} {}] on vector
05:47markomanbut perhaps i can do it with one, so I guess {:a {}} is preferred here?
05:47brehaut,(keep (fn [a] (when (#{:a :b} (first a)) a)) [[:a {}] [:b {}] [:c 1]])
05:47clojurebot([:a {}] [:b {}])
05:49markomanbut then the order of items need to be fixed: [{:a {}} {:b {}} {:c 1}]
05:50raekmarkoman: then you could as well do {:a [{} {}]} if you want to associate multiple things with a key
05:50brehautmarkoman: step back from your immediate question and tell us what you are trying to solve
05:51markomani think its solved, but maybe not best way. i need to think original data structure too
05:51brehauthttp://mywiki.wooledge.org/XyProblem
05:53brehauti wonder if i can teach clojurebot that
05:53brehautclojurebot: xy is http://mywiki.wooledge.org/XyProblem
05:53clojurebotOk.
05:54brehautclojurebot: xy?
05:54clojurebotxy is http://mywiki.wooledge.org/XyProblem
05:55markomanXy I'm aware. Usually when I come here and ask the question, I begin to see the solution when forming the question better way. and then ppl give really good tips and side notes on subject
05:55Fossigreat page
05:56fliebelBut the other side of the story if that if you ask for a specific Y, you get a solution to Y that is to general.
05:57brehautfliebel: i dont think i understand you
05:58fliebelbrehaut: Well, sometimes I want to do Y, but have a *very* good reason to want to do X, not not Z, which is the common way to do it.
05:58brehautoh right. yes agreed
06:00ahihi2is there a way to set the OS X application name in clojure? I tried (System/setProperty "com.apple.mrj.application.apple.menu.about.name" foo) as I'd do in java, but I still end up with "clojure.main"
06:11markomanim still struggling with empty? seq and nil
06:13markomansay (for [i (range 0 2)] nil) gives (nil nil) which is not empty, so how can I see, if for loop gives only nils which should be regarded as empty / no hits?
06:14raekmarkoman: (nil nil) is a list of 2 elements, not 0. that's why it's not empty
06:14markomanideally id like return value to be either [nil nil] to be [] or [nil "val"] to be ["val"]
06:14__name__(map not-nil? …)
06:15__name__ehm, (map #(not (nil? %)) …)
06:15raekmarkoman: ##(for [i (range 10), :when (odd? i)] i)
06:15sexpbot⟹ (1 3 5 7 9)
06:15raekmarkoman: you can use :when inside for to pick out only some of the values
06:16markomanah I see, it could work
06:17raekyou can also combine it with let: [... :let [x (some-function i)] :when (some-pred? x)] x
06:17raekin case you need to filter on the final value
06:17markomanbut I think it doesnt work, because I need to do stuff outside for []
06:18markomanok, :let changes the game again
06:47hoeckahihi2: maybe there is some strange limitation to when calling .setProperty is guaranteed to have an effect (only at class-initialization time or so)
06:48hoeckI remember having related problems when doing java gui stuff and trying to set swing properties, it wasn't as easy and dynamic as the setProperty method suggests :/
06:49ilyakHi *
06:49ahihi2well, it turns out apple's .jar -> .app bundler has a field for the app name
06:49hoeckhello ilyak
06:49ahihi2so I can just use that
06:49ilyakIs there something that works like (take-while), but is eager and also returns the rest of the sequence
06:50hoeckilyak: split-with
06:50ilyaki.e. starting from the element that failed predicate, if it failed immediately then the same sequence as was input
06:50ilyakcool, I'd check it
06:51hoeckahihi2: I think I did something similar, setting properties on jvm startup or so
06:52ahihi2yeah, that's probably what the bundled app does
07:17bsjdhello
07:19clgv&(println "hello to you too. ;)")
07:19sexpbot⟹ hello to you too. ;) nil
07:30TobiasRaederHi :)
07:30TobiasRaederIs there a way to set system properties when running tests via leiningen?
09:03@rhickeyconst! https://github.com/clojure/clojure/commit/8296b5f752fdb2926a309a7248d0d1bf6cb436b5
09:11TimMcIs this a metadata keyword? What does it do?
09:12TimMcI presume it does what :static is mistaken to do?
09:12clgvloo
09:12clgvups
09:12clgvlooks like it specifies a constant
09:13TimMcSure, but does that imply inlining?
09:14clgvTimMc: cant tell from that diff. I guess the intersting part is that one:
09:14clgvif(RT.booleanCast(RT.get(v.meta(),RT.CONST_KEY))) +      return analyze(C.EXPRESSION, RT.list(QUOTE, v.get()));
09:15clgvI don't know enough about the internal java implementation to guess if it does ;)
09:27clgvis there something like an alter-if function/macro?
09:28clgve.g. (let [m (alter-if mymap empty? (assoc k v))] ...)
09:29clgvI noticed the need for something like this for a couple of times now
09:34fliebelPython just beat Clojure for playing a ALAC file.
09:34fliebelclgv: Not in core at least, as far as I know.
09:36fliebelrhickey: What is const about? My best guess would be symbol macros or inlining or something like that.
09:37clgvfliebel: you'll know if you understand the meaning of: analyze(C.EXPRESSION, RT.list(QUOTE, v.get()));
09:40clgvhmm there is a "when-first" in core but no "if-first"
09:43@rhickeysorry, got called away right after I posted
09:44@rhickey(def ^:const x 42) will cause any compiled reference to x to be as if you wrote 42 instead
09:44avyskwhat's the easiest way to create something like {:foo 1 :bar 2} out of [:foo 1 :bar 2]?
09:45avyskI can do that, but is there something built-in?
09:45clgvavysk: ##(apply hash-map [:foo 1 :bar 2])
09:45sexpbot⟹ {:foo 1, :bar 2}
09:45avysk!!!
09:45avyskThanks
09:46avyskLooks obvious when one knows the right answer :)
09:46clgv$findfn [:foo 1 :bar 2] {:foo 1 :bar 2}
09:46sexpbot[]
09:46clgv$findfn hash-map [:foo 1 :bar 2] {:foo 1 :bar 2}
09:46sexpbot[clojure.core/apply]
09:47clgvhmok. I found a nice-to-have feature for sexpbot, I guess ;)
09:47Fossi,(into {} [:foo 1 :bar 2])
09:47clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword
09:47@rhickeyif you re-def x, no code will see that value until it's recompiled
09:47fliebelrhickey: So symbol macros indeed!
09:48@rhickeyfliebel: nope
09:48manutterrhickey: nice :)
09:48@rhickeyfliebel: symbol macros would in turn get evaluated, this is just straight constant data
09:49clgv$findfn [1 2 3 4 5 6] [2 5 6] [1 3 4]
09:49sexpbot[]
09:49fliebelrhickey: So what is it used for?
09:49@rhickeyfliebel: speed
09:49clgv$findfn [1 2 3 4 5 6] #{2 5 6} [1 3 4]
09:49sexpbot[]
09:50@rhickeywithout const, if you said (defn foo [] x), that code would have to get the value of x from the var every time
09:52@rhickeygotta run , have fun with const
09:53cemerickWe need a rhickey batlight, so he can swoop in when disaster strikes. :-)
09:53cemerickdn
09:53cemericko
09:53cemerickbah
09:54cemerickdnolen: I wish I could make your talk tomorrow. Any chance it'll be recorded?
09:55dnolencemerick: unsure, sort of last minute thing for me. Got some work to do...
09:55cemerickYeah, I figured. Good luck.
10:05dnolencemerick: thanks!
10:35anonymouse89is there a built-in to insert into a certain position of a list/vector/etc?
10:35anonymouse89(it's flat so I don't think I'm looking for zippers)
10:45raekanonymouse89: no, not for lists/sequences and vectors.
10:45hoeckanonymouse89: but vectors only support assoc
10:45anonymouse89raek, hoeck: thanks!
10:46hoeckso creating a new vec with a single element changed works
10:46anonymouse89hoeck: right, but still no insert
10:46raekyou can still do it with (concat (take i coll) (drop (inc i) coll)) for sequences and (into (subvec coll 0 i) (subvec coll (inc i)))
10:46raekthose run in linear time though
10:47hoeckI'm usually using (apply vector (subvec src 0 X) [new elems] (subvec src X)) to 'insert' into vectors
10:47raekfinger trees is a persitent data structure that allows you to do these kind of things efficiently
10:48hoeckraek: is there a working implementation?
10:49anonymouse89raek: yeah, I saw the recorded talk from the conj. I'm also wondering about working implementation.
10:49raekhttps://github.com/clojure/data.finger-tree
10:49raekit's available, but I haven't tried it myself
10:51hoeckraek: last time I heard from finger trees, there was only a gist with an implementation, this looks better now :)
10:52Fossifinger tree sounds creepy
10:54hoecksounds like "magic nose goblin" to me
10:55fliebelThese trees have been sitting in the back of my head for a while now, waiting for a legitimate use case.
10:55Fossiurgh. the image doesn't get better
10:56fliebelFossi: Have you seen the image in the presentation?
10:56Fossinope
10:57Fossinow i'm not sure whether i want to either ;)
10:57anonymouse89reminds me of The Labyrinth
10:57anonymouse89(sorry, very offtopic)
10:58fliebelFossi: http://talk-finger-tree.heroku.com/#5
10:58Fossias if the topic at hand was that important ;)
10:58Fossiah
10:58anonymouse89fingers! what is more important
10:58Fossifunky
10:58pjstadigclojurebot: const is <reply><rhickey> (def ^:const x 42) will cause any compiled reference to x
10:58pjstadig to be as if you wrote 42 instead
10:58clojurebot'Sea, mhuise.
10:58pjstadigclojurebot: const is <reply><rhickey> (def ^:const x 42) will cause any compiled reference to x to be as if you wrote 42 instead
10:58clojurebot'Sea, mhuise.
10:59fliebelconst
10:59TimMcconst?
10:59clojurebot<rhickey> (def ^:const x 42) will cause any compiled reference to x
10:59pjstadigclojurebot: forget const |is| <reply><rhickey> (def ^:const x 42) will cause any compiled reference to x
10:59clojurebotI forgot that const is <reply><rhickey> (def ^:const x 42) will cause any compiled reference to x
10:59pjstadigconst?
10:59clojurebot<rhickey> (def ^:const x 42) will cause any compiled reference to x to be as if you wrote 42 instead
10:59TimMcconst?
10:59clojurebot<rhickey> (def ^:const x 42) will cause any compiled reference to x to be as if you wrote 42 instead
11:00pjstadigclojurebot: forget const |is| <reply>(def ^:const x 42) will cause any compiled reference to x
11:00clojurebotI forgot that const is <reply>(def ^:const x 42) will cause any compiled reference to x
11:01pjstadigclojurebot: const is <reply>(def ^:const x 42) will cause any compiled reference to x
11:01clojurebotIk begrijp
11:01TimMcwhat
11:01pjstadigclojurebot: forget const |is| <reply><rhickey> (def ^:const x 42) will cause any compiled reference to x
11:01clojurebotI forgot that const is <reply><rhickey> (def ^:const x 42) will cause any compiled reference to x
11:01pjstadigconst?
11:01clojurebot<rhickey> (def ^:const x 42) will cause any compiled reference to x to be as if you wrote 42 instead
11:01pjstadigclojurebot: forget const |is| <reply><rhickey> (def ^:const x 42) will cause any compiled reference to x if you wrote 42 instead
11:01clojurebotI forgot that const is <reply><rhickey> (def ^:const x 42) will cause any compiled reference to x if you wrote 42 instead
11:01pjstadigconst?
11:01clojurebot<rhickey> (def ^:const x 42) will cause any compiled reference to x to be as if you wrote 42 instead
11:01pjstadiggah
11:02pjstadigi'm in over my head
11:02TimMcCan this be done in PM with clojurebot ?
11:02pjstadigthought right might not want the notifications...
11:02pjstadigyeah
11:02TimMc123456789?
11:02clojurebot987654321
11:02TimMcYeah, it can.
11:03danlarkinpjstadig causin' problems
11:04TimMcpjstadig: clojurebot is currently a blank slate for const
11:04pjstadigfixed :p
11:04pjstadigconst?
11:04clojurebot(def ^:const x 42) will cause any compiled reference to x to be as if you wrote 42 instead
11:04TimMcLooks good.
11:06TimMcI have a list of values, how do I tell if they are all truthy?
11:08raek,(every? identity [true 1 0])
11:08clojurebottrue
11:08TimMchah!
11:08Raynes&(every? identity [1 2 3 false 0 true])
11:08sexpbot⟹ false
11:08Raynesraek: I hate you. :<
11:08TimMcThanks, that makes sense.
11:09RaynesMy downfall is that I test my code in my own REPL before spewing solutions.
11:09TimMchaha
11:09RaynesIt's a bad habit, I'm sure. ;)
11:18TimMcContext: I'm rewriting clojure.test/are to return logical true if all tests pass.
11:22TimMcNow I can pass predicates like #(are [k v] (= (k %) v) :a 1, :b 2) to helper functions in my test classes that set up complicated data structures.
11:22TimMc(Testing the tests and whatnot.)
11:24anonymouse89pmapcat?
11:25fliebelanonymouse89: Nope, (aply concat map)
11:25fliebel*pmap
11:25fliebel*apply
11:25anonymouse89fliebel: i got the idea :)
11:55cemerickhttp://cemerick.com/2011/04/19/clojure-atlas-preview/
11:57osolevefrom a complete newbie's standpoint, looks like a very interesting and useful tool
11:59osoleveaww, 'try it' fooled me :(
12:00cemerickosoleve: your interest is duly noted :-)
12:00cemerickThe ontology is woefully incomplete still. When it's only staggeringly incomplete, I'll open things up.
12:01osolevelooking forward to it
12:01fliebelcemerick: Do you count the number of people that tried vs bought?
12:01cemerickfliebel: ah, that would've been smart, huh? :-)
12:02cemerickI doubt very many would click on the buy link straight off in any case.
12:02fliebelcemerick: Well, just append a hash to one and google analytics will count for you ;)
12:02osolevecemerick, i clicked it when i realized 'try it' didn't work :[
12:02osolevehaha
12:03fliebelcemerick: Is the $20 for real, or is the button as a while a joke?
12:03fliebel*whole
12:04cemerickfliebel: real?
12:04fliebelcemerick: In other words, will it cost $20 when it's done?
12:05cemerickfliebel: It'll definitely be paid, yes. Where the price lands in not yet certain.
12:05cemericks/in/is
12:05sexpbot<cemerick> fliebel: It'll defisitely be paid, yes. Where the price lands is not yet certais.
12:05osolevehaha
12:06fliebelcemerick: Do you make the relations yourself, or do you use extensive introspection?
12:06cemerickfliebel: The source, docs, and class hierarchies I can gather in an automated fashion. Everything else needs to be built manually.
12:06osolevecemerick, is it written in clojure?
12:07fliebelcemerick: It would be cool to get 'everything else' as metadata upstream in Clojure.
12:07cemerickIf I could build an accurate ontology like this in an automated way, I'd go build a $10K-per-site app.
12:07cemerickosoleve: Certainly, though there's probably more javascript in the source repo than clj.
12:08osolevecemerick, neat
12:08cemerickfliebel: The clojure jar would be a *lot* larger than it is now :-)
12:08osolevei'm excited to start learning clojure, i've had a lot of fun in the past with scheme/CL
12:08cemerickAnd Rich would simply quit
12:08fliebelhaha
12:10fliebelcemerick: Good luck with that. I could never do such a thing. I'm the kind of person who would rather spend an hour(or even a day) writing a script to do some repetitive task that takes ten minutes.
12:11cemerickfliebel: where there's muck, there's (hopefully) brass :-)
12:11ieureInteresting, cemerick.
12:11ieureIt looks nice, I hope it works out ofr you.
12:11ieure*for
12:11fliebelcemerick: I'm no american, so I have no idea what that means… not exactly anyway.
12:12ejacksonhm.... looks like I arrived into an interesting conversation...
12:12manutterit started here: http://cemerick.com/2011/04/19/clojure-atlas-preview/
12:13fliebelah http://www.phrases.org.uk/meanings/408900.html
12:13osoleveguys, quick question. for a newbie, cake or lein?
12:13fliebelosoleve: Whatever name sounds better to you.
12:13manutterI'm still fairly noobish and I'm partial to lein
12:14manutterthough to be frank I haven't played much with cake
12:14cemerickfliebel: that's the best answer I've heard to that question in a while :-)
12:14ieureI’m intermediate. Lein works great, I haven’t messed with cake.
12:14osolevemmk, thanks
12:14ejacksonpish, butterflies.
12:15fliebelcemerick: you have these pointy things on your lambda, have you considered using the maps api for real?
12:15fliebelI mean, zooming, searching, paning, it's all there.
12:15ejacksoncemerick: I'd like to volunteer as a concerned citizen.
12:15cemerickfliebel: You mean for the actual visualization?
12:16fliebelcemerick: Yea, the only thing that'd remain is putting the data through graphviz.
12:16cemerickejackson: :-) drop your email into the allotted space, and you'll get a note sooner or later :-)
12:16ejacksongroovy.
12:16Raynesmirah.
12:17cemerickfliebel: graphviz would produce an unintelligible muck. You need to be able to restrict the scope of the visualization or you'll be blinded by the proliferation of edges.
12:17Raynescemerick: What do you use to draw illustrations in Clojure Programming?
12:18cemerickRaynes: we don't; O'Reilly has illustrators that take care of it
12:18RaynesMy book is illustrationless. Makes Rayne sad.
12:18fliebelcemerick: Okay, very true.
12:18RaynesI suppose I could just sketch some and No Starch would take care of it.
12:18RaynesBut that feels weird for some reason.
12:18manutterwhat kind of illustrations do you need?
12:19RaynesI doubt I'll need anything more interesting than lines and boxes. I could do that in gimp, but meh. I don't like drawing on a computer.
12:19fliebelRaynes: At least Manning has these whateverth-century figures they use :)
12:20manuttercheck out VUE from tufts.edu, it might give you some ideas
12:20manutterIt's actually concept mapping but I was playing with it and it seems like it has some interesting applications
12:20fliebelcemerick: What kind of data do you display that can't be retrieved by introspection?
12:21cemerickfliebel: The manual bits include defining the "concept" nodes, and all of the edges everywhere.
12:22fliebelah, okay.
12:44markomananyone familiar with hiccup?
12:45technomancyclojurebot: hiccup is also http://tinyurl.com/426og7n
12:45clojurebotIn Ordnung
12:46technomancyclojurebot: wait a minute, you're not fsbot
12:46clojurebotI don't understand.
12:46technomancyclojurebot: forget hiccup |is| also http://tinyurl.com/426og7n
12:46clojurebotI forgot that hiccup is also http://tinyurl.com/426og7n
12:47technomancyclojurebot: hiccup is both https://github.com/weavejester/hiccup and http://tinyurl.com/426og7n
12:47clojurebotYou don't have to tell me twice.
12:54KirinDavemarkoman: Yes. But you should be using enlive 90% of the time.
12:55KirinDavemarkoman: Hiccup is most useful for A -> NodeSeq transformations to feed enlive when it's awkward to use its for loops.
12:56markomanhmh.. so far everything has worked well inside html form. i think i once had a strange situation where it didnt work like i expected
12:58markomanKirinDave: has enlive made any attemption to automate translation of terms inside html forms?
12:58KirinDavemarkoman: Nope.
12:59KirinDavemarkoman: But... really?
12:59KirinDavemarkoman: The 18 lines of code it would take to make that happen, with the gain being a much-improved model and superior modularity, are not worth that minor investment?
13:00markomanyes, I was thinking this last week [:div "some content" [:a "link text"]]
13:00manutterThat's something I've been wondering lately too
13:01markomanwould it be bad idea to use html tag path to the text content and msomehow automate translation of terms?
13:02manutterI've got an enlive setup where english page templates are under html/en/ and french under html/fr, etc, but how to internationalize the messages generated internally?
13:02KirinDaveWell that's where something like hiccup could be part of a solution.
13:02markomanKirinDave: what do you mean with 18 lines of code?
13:03thorwilRaynes: for anything even vaguely resembling a technical diagram, choose inkscape over gimp. the difference is kinda like a scripting language vs assembler
13:03redingercemerick: Okay, signed up for Atlas. Looking forward to trying it out!
13:03KirinDavemarkoman: If I understood what you're saying, it's not terribly difficult to write code to take an incoming request and pull out/check/retype/escape form paramters.
13:05markomanmanutter, KirinDave: right, I'm sure there is a pretty simple solution there for this task. and I would be more than happy to find it and test on my code
13:05cemerickredinger: Thanks :-)
13:05cemerickIt's coming soon enough, just wanted to get a feel for the level of concrete interest before committing to the bulk of the manual work.
13:06manutterIn my day job, we have a gazillion-line php app, full of code that looks like __("Please enter your password") -- the double underscore is a function call that uses the english text as a key to look up a translation
13:06manutterthere's a command-line script that scans all the php files and builds dictionary files for all the double-underscored prompts, and then you can send the files to a translator to edit/translate
13:06markomanexactly
13:06manutterIs there something similar in the clojure/java world?
13:07joegallohttp://download.oracle.com/javase/6/docs/api/java/text/MessageFormat.html
13:07amalloymanutter: you could write one in like an hour
13:08markomansomehow i think if you write templates like: [:div "some content" [:a "link text"]] you could get context related terms nicely as a side effect so to say
13:08cemerickmanutter: resource bundles are the JVM-standard way to do these sorts of things: http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/
13:08joegalloMessageFormat + Locale + ResourceBundle basically does it
13:08manutterCool, I figured there'd be something like that
13:09manutterthanks
13:15markomanidk, you need to specify these terms: GOODBYE_TEXT, CANCEL_BUTTON_TEXT,... zillions of those, it seems a lot of work
13:15markomanextra duplicious work
13:15manutterOh, it works with predefined keys and such?
13:15manutterI haven't had a chance to look up the refs yet.
13:16markomani briefly looked ResourceBundles
13:16manutterThe php stuff is nice (can't believe I'm saying that!) because it uses the actual strings instead of predefined constants
13:17manutterThe downside is that if you have __("Last Name") and __("Last Name:"), it will create separate entries for the versions with and without the colon
13:18amalloymanutter: that is not a downside
13:18markomanbut __() is still a function, would be easy on clojure too i think. but like you said, there is repeating stuff, contextual stuff and other going on on
13:18manutteramalloy: Yeah, not the best example off the top of my head, but you get the idea
13:19manutterthe translator sometimes ends up translating the same string multiple times with only slight cosmetic variations.
13:19amalloyyeah
13:19amalloybut it's often hard for you to know what variations are really cosmetic, so it's not really something i'd worry about
13:19markomanid like to get around it by thinking I have already specified the path and text, now how can I get them on separate language files using what I already wrote as a default value
13:20cemerickusing actual strings instead of semantically-significant keys seems like a recipe for very subtle translation bugs
13:22manuttercould be
13:22markomanbut i would still like to test that path
13:22amalloycemerick: atlas looks pretty shiny
13:22cemerickamalloy: Thanks :-)
13:23cemerickThe site is not horrible, but I think the actual visualization is really ugly at the moment.
13:23cemerickThus, "preview".
13:26osolevehow do you represent characters? like, in Scheme, for a you'd put #\a
13:26manutterjust \a
13:26osoleveokay, thanks
13:26osoleveand does that work for parens?
13:27manutterI believe so
13:27osolevenifty. thank you.
13:31osolevehm. how come (contains? '(\+) \+) evaluates to false?
13:32fliebelosoleve: You want `some`
13:32fliebel(contains? '(\+) 0)
13:32fliebel&(contains? '(\+) 0)
13:32sexpbot⟹ false
13:33amalloycontains?
13:33clojurebotcontains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use the java method .contains
13:33fliebelhm… ##(some #{:a} [:b :a c])
13:33sexpbotjava.lang.Exception: Unable to resolve symbol: c in this context
13:33fliebel(some #{:a} [:b :a :c])
13:33fliebelgrrr
13:33osoleve&(some (\+) \+)
13:33sexpbotjava.lang.ClassCastException: java.lang.Character cannot be cast to clojure.lang.IFn
13:33amalloyclojurebot: contains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use clojure.core/some or the java method .contains
13:33clojurebot'Sea, mhuise.
13:34amalloy&(some #{'+} '[- a +])
13:34sexpbot⟹ +
13:34amalloy&(some #{'*} '[- a +])
13:34sexpbot⟹ nil
13:35osoleveis there a way to get that to work for characters instead of symbols?
13:35amalloyosoleve: it already does
13:35amalloyjust take my last example, swap the symbols for characters, and BAM
13:37osoleveohhhkay. thanks.
13:41osolevei promise my questions will have more substance before long, by the way :)
13:44amalloyheh
14:20osolevewhat's wrong with this function? i get "unable to resolve symbol: stack in this context" and two unmatched parentheses, but I can't find them. :( https://ideone.com/Oq8d8
14:21amalloywell the former is caused by the latter, i'm sure
14:21amalloyosoleve: ' doesn't delimit strings in clojure
14:22osoleve...oh, that fixed it. thanks!
14:22amalloyyou also don't *have* to quote '(), but it's no crime to do so
14:23osoleveokay, good to know
14:23choffsteinHey all -- quick question. Does clojure have a pattern similar to Ruby Facet's ergo, the gem andand, or try (http://ozmm.org/posts/try.html). Basically -- it allows you to say, 'perform this method if the object is not nil'. I run into this pattern a lot and created a macro to do it for me -- but I was wondering if clojure had something more elegant. It's basically a Maybe Monad...
14:23osoleveis it weird to feel like there *aren't enough* parentheses in clojure?
14:24TimMcosoleve: Like in let bindings and maps?
14:24amalloyclojure.contrib.core/-?>
14:24osolevespecifically, in cond
14:24amalloyor just use (or), choffstein
14:25amalloyi guess or is a silly solution
14:25choffsteinamalloy: can I carry you around in my pocket?
14:25TimMcamalloy: botsnack
14:26amalloyThanks! Om nom nom!!
14:26choffsteinyou are quite amazing.
14:26choffsteingotta reboot the computy. thanks for the quick answer :)
14:29amalloy$botsnack
14:29sexpbotamalloy: Thanks! Om nom nom!!
14:56raektechnomancy: Getting Started with Emacs links to your repo for package.el. Where should the user put the file in order to use it? Should something be added to the .emacs file also? (I'm thinking about the non Emacs Starter Kit case here)
14:57technomancyraek: yeah, that should be http://bit.ly/pkg-el23 these days.
14:57raekok, I'll change that
14:58technomancyeither my wiki privileges got reverted or I am not smart enough to figure out confluence or I would do it myself
14:58raekthe Edit button appears if you have write access. it should be left to the Add button
14:59raekI had to ask clojure-dev after the move to confluence to get write access
15:01raektechnomancy: also, i vagely recall that you had doubts regarding whether lein repl would work as an inferior-lisp-program. well, it works fine for me.
15:01technomancyyeah, I had access at one point. dunno what happened.
15:01technomancyoh nice
15:03raekI think they restricted the write access to members of the clojure-dev group only a while ago
15:04redingertechnomancy: You have access again
15:04redingerSorry about that
15:28osolevehow do you differentiate, visually, between a predicate and a clause in a cond?
15:28osoleveemacs clojure-mode is lining them up for me and it's throwing me off
15:29cemerickpreds and clauses generally are paired on the same line
15:29malkomalkowhat's the best way in a for loop to build up some type of seq? is it really something like (def v (conj v 1)) ? that seems anti clojurish
15:30cemerickIf you have a degenerate case where your case and/or clause are very large, put each on their own line, with an additional line on either side of the pair
15:30osolevecemerick, ahh, okay. thank you.
15:31amalloymalkomalko: holy moly no
15:31malkomalkoI know :)
15:31ataggartmalkomalko: the for loop creates the seq, you just need to have the body emit the element, e.g. (for [x (range 10)] (* x x))
15:32malkomalkobut we need to keep track of certain things from iterating through the loop
15:32malkomalkowe just don't want to return things from the loop, but push things into a stack, and do certain things based on some type of logic
15:33ataggartthen you don't want to use for. Perhaps reduce.
15:33amalloymalkomalko: putting a :when clause in your for loop would solve your issue but you're being pretty vague so it's unclear if that's what you mean/want
15:33amalloyataggart: untrue! ##(for [x (range 5) y (range 5) :when (> y x)] [y x])
15:33sexpbot⟹ ([1 0] [2 0] [3 0] [4 0] [2 1] [3 1] [4 1] [3 2] [4 2] [4 3])
15:34ataggartyes, but my statement was based on "push things into a stack"
15:34amalloyobviously a dumb toy example, but you can arrange for your for to not include some elements
15:34malkomalkowe need to iterate through a list, and capture every "foo", then for every "foo" we need to tell when the last "bar" event form the same sequence happened and assign it to the proper "foo"
15:34amalloyataggart: we're both guessing at what he actually wants
15:34fliebelxy?
15:34clojurebotxy is http://mywiki.wooledge.org/XyProblem
15:34malkomalko#/form/from/
15:35fliebelweee
15:35amalloy~o/
15:35clojurebot\o ... High five!
15:35amalloycutest command ever
15:36fliebelmalkomalko: Yea, sounds like reduce with a compound reduction should work.
15:36amalloyfliebel: well, reduce *always* works
15:36fliebel:)
15:36amalloyit's like a sledgehammer of doom
15:37amalloygreat tool, super-powerful, but if you solved *everything* that way it'd be awkward
15:37malkomalkoWe're working with a iterator-seq and need to accomplish this in one pass
15:37fliebelamalloy: True, but what else? Plain loop/recur? I don't see much else, besides atoms and such doing this.
15:38malkomalkothink we need a reduce.. you might be right
15:39amalloyfliebel: reduce looks like the best solution to problem X, indeed
15:40raekmalkomalko: I think of something like (reduce (fn [foos x] (cond (foo? x) (assoc foos ... x ...), (bar? x) (update-in foos [(foo b)] ... x ...), :else foos)) {} coll)
15:41malkomalkothanks.. gonna give that a go and pull it a part
15:42raekhere, "foos" is passed to the function and the new "foos" is returned. this might remind you of assignment, but no mutation is actually performed
15:46ataggartmalkomalko: https://gist.github.com/929424
16:05technomancyredinger: aha; thanks.
16:05technomancy(was at lunch)
16:05technomancyI'm never sure with confluence/jira if it's a pebkac or not.
16:16markomanhmh, how do you catch exceptions on clojure? Im getting null pointer and hard to debug what causes it
16:16markomanjava.lang.NullPointerException
16:17ieuremarkoman, http://clojure.org/special_forms#Special Forms--(try expr* catch-clause* finally-clause?)
16:17ieureHm, not sure if Chrome bungled that URL or what.
16:17ieureBut you should get the idea.
16:20markomanthanks. it ways catch classname name, what should I use in these?
16:21markomanjava.lang.NullPointerException is classname, what is name then?
16:24ieureI think you want (catch NullPointerException)
16:31markomanlets see, maybe i should really study to use emacs gdb
16:32markomanif I just knew how to put debug point on file
17:49raektechnomancy: I'm about to change the link in the confluence wiki to http://bit.ly/pkg-el23 now, but I would also like to add some instructions on what do with the file... So, what is the recommended way? Just put it in .emacs.d/ and add (require 'package) to .emacs or something?
17:51technomancyraek: oh... yeah, you need to add marmalade as a package source. the instructions on http://marmalade-repo.org are good.
17:51raekyes, the marmalade part is already in place
17:52raekit's the package.el installation process I'm concerned about now
17:53technomancyoh, sure. download, require, add-to-list is all.
17:53znutar_is there any risk to adding extra sources for elpa packages if I want extra stuff like haskell mode through elpa? Is there an ordering that matters, or does it just look for the latest version of any packages available?
17:55technomancyI think highest version wins.
17:57raektechnomancy: so this is what I will use as an example: https://gist.github.com/929822 any comments?
17:57raek(note that I don't have much experience with how these things should be done prooperly)
17:59technomancyraek: that should work.
17:59raektechnomancy: ok, thanks a lot for the help!
18:00technomancynp; thanks for curating
18:14raekupdated: http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
18:59eckrothI want to switch to clojure 1.3 to use priority-map; I've listed org.clojure.contrib/command-line 1.3.0 in my project.clj; but if I try to :use it, I get an error
19:00eckrothis there a way to determine if 1.3 command-line is being loaded or if 1.2 is being loaded (since other deps bring in contrib 1.2)?
19:00eckrothadding :verbose true to the :use statement shows: (clojure.core/load "/clojure/contrib/command_line") and so on but no info about version
19:02_atoeckroth: try (-> (clojure.lang.RT/baseLoader) (.getResource "clojure/contrib/command_line.clj"))
19:02_atoshould tell you the jar it's from
19:03eckroth_ato, awesome, it worked: #<URL jar:file:/.../lib/clojure-contrib-1.2.0.jar!/clojure/contrib/command_line.clj>
19:04eckrothnow I just need to "force" version 1.3.0 to be :use'd
19:12carllerchedo all protocol implementations have to be in the same namespace?
19:12amalloycarllerche: definitely not
19:13carllercheI defined a protocol and implemented it in other namespaces... if I require the namespace, how can I refer to the function? It seems that I have to refer to it w/ the namespace
19:14carllercheI'm probably misunderstanding something wrt protocols & records
19:15carllercheamalloy: do I refer to a function by the namespace that defines the protocol then?
19:15amalloyyes
19:17amalloy(ns a) (defprotocol Animal (noise [])) (ns b (:require a)) (extend-protocol a.Animal Dog (noise [] (bark))) (a/noise (Dog.)) ; vaguely
19:17amalloyi don't have the syntax right because i don't use protocols much, but the protocol stuff all lives in the originating namespace
19:18raekso it's not a/Animal?
19:19amalloyraek: i dunno. like i said, syntax
19:19amalloyit's in a, anyway
19:19raekok, I played a bit with it in the repl
19:19raekshould be a/Animal
19:20raekand protocol methods require at leas one "this" arg
19:21raekcarllerche: protocols and protocol methods follows the same rules as regular defs and defns when considering namespaces
19:21carllercheok... let me see if I can get this to work...
19:22raekdeftypes/defrecords though... they need to be imported (since they become java classes)
19:23carllercheIn amalloy's example, (noise...) doesn't take an argument, but one is passed. is it implied?
19:23raekalso, you don't need to qualify the protocol method names, only the protocol name
19:23raekno, it's a syntax error
19:23carllerchehehe
19:23raekbetter than "syntactic salt"?
19:25raekeh, the comment re. namespace qualified names was meant to refer to the (extent-protocol ...) form
19:26amalloyraek: i got that part right, didn't i? qualified Animal but not noise
19:26raekyup, I just read that incorrectly
19:33joshuaHow do I write a function in Clojure which returns a recursive function?
19:34amalloy(fn foo [x] (foo (dec x)))
19:34brehaut(constantly reduce)
19:35eckrothwell I thought I could just update libraries to use clojure 1.3; but I can't update them all; how can I force :use of a certain version of a clojure.contrib library?
19:35ieurejoshua__, Can you be a little more specific? Do you really mean a function which _returns_ a different, recursive function?
19:35amalloybrehaut: i'm aware that you're kidding, so i'll play along: reduce isn't really recursive, it uses loop/recur. you must mean (constantly iterate)
19:35ieurejoshua__, Or are you asking how to write a recursive function?
19:36joshua__ieure, Yes. I mean a function which returns a different recursive function.
19:36amalloyi think joshua__ just means http://stackoverflow.com/questions/5626641/non-tail-recursive-anonymous-functions-in-clojure/5626864#5626864
19:36brehautamalloy: reduce abstracts recursion; the implementation is merely a detail
19:36eckrothjoshua__, can you just return a (fn myfunc [x] ....) so that you can use myfunc as the recursive call
19:37joshua__eckroth, I'll let you know. I hadn't realized I could give an anonymous function a name like that.
19:37ieurejoshua__, I’m not 100% sure you’re asking the right question; but you’d just say: (fn [] (let [recursive-function (fn [x] (recursive-function (dec x)))] recursive-function))
19:38amalloyieure: that doesn't work actually
19:38ieureamalloy, :(
19:38eckrothieure, isn't it easier to do (fn myfunc [x] ... (myfunc (dec x))) etc.?
19:38amalloywhich is what (fn the-local-name [...]) form is for
19:38ieureeckroth, Guess so, I wasn’t aware that you could label functions like that.
19:38eckrothieure, right, I haven't yet used it myself either
19:39ieureOf course you probably really want to return a method that uses loop/recur to avoid blowing the stack.
19:39raekif you use letfn, it will do both (let [foo ...] ...) and (fn foo ...)
19:39amalloyieure: i actually use this feature semi-regularly
19:39amalloyto implement anonymous lazy-seq functions that call themselves lazily instead of with loop/recur
19:39raek"named anonymous functions"...
19:40raekeckroth: this stuff is complicated. basically, you should never have two versions of the same lib on the classpath at the same time
19:41eckrothraek, thanks for the response; yeah it sucks but some deep dependency (of incanter I think) pulls clojure.contrib 1.2
19:42eckrothraek, frankly I'd rather drop incanter than muck with this for hours :(
19:42joshua__amalloy, thanks amalloy. Got it workingg.
19:42ieurejoshua__, I would recommend that you check out loop/recur.
19:42ieureYou don’t have to mess with labeling your fn at all, and you won’t blow the stack.
19:42raekhrm, I guess maven can't figure out that they are the same thing in this case, since you have one monolithic contrib version and one contrib module (and those are treated as different libs)
19:43joshua__ieure, ieure I was actually using those, but they didn't work in this case. It wasn't a tail recursive function call if I wanted to express it in the form in which I wanted to express it.
19:43eckrothraek, well problem (probably) solved: dropping incanter dropped c.contrib 1.2 plus a whole lot of other junk (eg. servlet-api, log4j, etc.) a bit ridiculous I think
19:45ieurejoshua__, Okay, just making sure you’re aware of the risks and the tools to mitigate them.
19:48raekeckroth: hopefully, this will be less painful when everyone has migrated to "new contrib"
20:09carllercheIs there a way to recompile everything in emacs instead of C-c C-k for each buffer?
20:12technomancycarllerche: M-x mark-buffer C-c C-r
20:12technomancyor C-c C-l to force all other required namespaces to reload
20:13amalloytechnomancy: C-x h is bound to M-x mark-whole-buffer
20:13carllerchetechnomancy: thanks
20:13technomancyamalloy: ah... I rebound that ages ago and recently dropped my rebinding, so it's missing from my mental mapping
20:14technomancycarllerche: hard to say what's best without knowing why you don't want to use C-c C-k though
20:15amalloybrb, gotta go tweet that i knew something about emacs that technomancy didn't
20:15carllerchetechnomancy: I changed a protocol implementation it seems in one file and ran the tests, and got an error saying the protocol wasn't implemented
20:16carllerchetechnomancy: and the "fix" (unless I did something wrong) was running C-c C-k in all buffers that used functions from that protocol
20:17eckrothcarllerche, I'm glad you asked this question; hopefully someone knows the answer; I always resort to lein clean in such cases :(
20:17carllercheI had the files in question already opened so i just went to them and recompiled, but I can see how that could get out of hand
20:19eckrothcarllerche, actually, the problem strongly discouraged me from using records, so I brought their use down to just one; maybe I am missing some great benefits, though
20:19technomancymy solution so far has been not to work on files that involve protocols and records. =\
20:27carllercheeckroth: do I have to bounce lein swank after running lein clean?
20:28eckrothcarllerche, ugh, good question; I'm still figuring this out (the best way to manage a repl)
20:29eckrothcarllerche, obviously that'd work, but I hope it's not necessary; you might want to google for how to clean the repl's definitions
20:31eckrothcarllerche, you might try this: http://stackoverflow.com/questions/5409345/clojure-repl-doesnt-pick-up-changes-made-to-defrecord/5409404#5409404
20:32eckrothcarllerche, or: http://www.learningclojure.com/2011/01/cleaning-old-definitions-from-repl.html
20:45carllercheeckroth: the reload-all trick didn't seem to reload the protocol / record stuff :(
21:37cemerickThat Steve Yegge thread is bizarre.
21:37KirinDavecemerick: He is, as a rule, a weird guy with a weird following.
21:37KirinDavecemerick: Like, you'd think he'd be really into certain aspects of FP. Ask him about it tho, and he gets a slightly agitated demeanor.
21:38KirinDavecemerick: Mentioning Haskell to him is, it is reported, an excellent way to get blown off.
21:38cemerickHe goes on and on about nonlocal exits, as if that's the ticket to nirvana or something.
21:38cemerickJust really strange.
21:38KirinDavecemerick: This is not really an industry known as a bastion of stable people. :)
21:39brehautgot a link for this thread?
21:39hiredmanfirst thing approaching a conversation I've had with him (didn't make it to the seajure meet up) and I am already convinced he is a complete tool and can no longer bring myself to read anything he has written :(
21:39cemerickhttp://groups.google.com/group/seajure/browse_frm/thread/18baa18ffdbdd790
21:40cemerickI'm generally all about inclusiveness and marketing, but I found myself nodding along with hiredman's replies, so there's a data point. ;-)
21:40lancepantzheh
21:41lancepantzscary
21:41johnmn3hi
21:41KirinDaveWell let's consider why Yegge is famous.
21:41KirinDave1. Epically long rants
21:41KirinDave2. Very approachable theory
21:41KirinDave3. Really long rants
21:41cemerickI didn't realize people got burnt for wanting to use CL-style loop macros.
21:42cemerickpprint is driven by CL-style format, fer cryin' out loud
21:42cemerickit's not like we're a bunch of raving lunatics (for the most part)
21:43cemerickKirinDave: I had bought into the theory that he was building the acceptable lisp (i.e. better javascript) when he went to Google.
21:43cemerickGoes to show just how not-plugged-in I am.
21:44hiredmanI may be a lunatic, but I am an engaged lunatic
21:48ataggarthas anyone seen Steve submit a patch for clojure?
21:49cemerickNo; that was one of hiredman's points.
21:49hiredmanI asked him to point them out so they won't be overlooked
21:49cemerickheh
21:51brehautwtf "What Clojure needs is to be non-prescriptive." the prescriptive parts are what make it so damn great. sigh
21:51hiredmanI almost pulled the trigger on an email to stu saying he is "no moses" and "rich is no god" so "when he comes back from the mount with tablets I have questions"
21:51cemerickThere's a lot of very sad gems.
21:51hiredman(been listening to jewish reggae)
21:55znutar_less prescription, more proscription
21:55ataggartthe only clear issue he brings up is single-passI see only one clear issue he brings up, single-pass compilation. He seems to have a lot of free time on his hands.
21:55ataggartoh well, portal2 just finished downloading.
21:56hiredmanit will be interesting to see what he comes up with for a debugger
21:57hiredmanI don't think single pass compilation is a burden, but I will admit that maybe if it went away suddenly some hitherto undiagnosed malaise might go away
21:57hiredmanbut I have no firm feeling that it is a problem
21:59brehautalso i am under the impression that his beloved javascript is single pass
22:00hiredmanwell, I think he ended up on js because he didn't see an viable alternatives, so hardly his beloved
22:01brehautsure.
22:03cemerickThe merits of this compiler design or that one are sort of moot in the big picture. Clojure's not "dead at the starting gate" because of a choice there or bit shift operators or what-have-you.
22:04cemerickIt's just a list of local problems that likely seem REALLY IMPORTANT in a local context.
22:04cemerickAnyway.
22:06znutar_Doesn't a tendency towards non-prescriptivism in the language idiom combined with macros and such just lead to a kind of language-learning hell where you have to learn a different DSL for every nook and cranny?
22:07znutar_I'm not a lisper so I don't really have much context, but that'd seem to be the peril of that approach.
22:08johnmn3and clojure offline html preprocessors out there? Like this: http://dorward.me.uk/software/dolt/
22:08cemerickEvery language is prescriptive, it's just a matter of degrees and orientations and cliques.
22:09cemerick"Multiparadigm" just means that there's multiple prescriptions all operating in parallel.
22:18ttmrichtercemerick: Often with painful sharp edges clashing over your rapidly-cooling corpse. :)
22:19cemerickttmrichter: did someone mention C++? ;-)
22:20ttmrichterI wonder why that language leaped to the forefront of your thoughts....
22:21brehautit had to be that or javascript
22:32TimMcbrehaut: JS doesn't really have prescriptions...
22:32brehautTimMc: it does, its just got 6 of them and they are only half implemented
22:33TimMcI think of it more as layers of fads in JS architecting.
22:33brehautthere is at least: procedural, prototypal, classical, functional
22:33brehautand they have all been there since ever
22:34TimMcHmm, I think I was on a slightly different track.
22:34TimMcI'll agree with that assessment.
22:34brehautTimMc: i will agree that it has fads
22:35TimMcI don't think I've seen prototypal in the wild.
22:35brehautTimMc: one of the things i like least about JS is how every library has a radically different style
22:35brehautTimMc: http://jslint.com/
22:35TimMcWhat, is that done in JS?
22:35TimMcprototypally?
22:36brehautyes
22:36TimMcUnfortunately, I need to get back to studying for my comp graphics exam, so I can't keep on in this discussion. :-(
22:36brehautJS Lint is written by crockford who is the most vocal proponent of prototypal JS
22:36TimMcaha
22:36TimMcyes he is
22:36brehautin particular check out the parser
22:36brehautits a prototypal pratt operator presendce parser
22:37TimMcwill do
22:46chewbran1ahi all, anyone using clj-http to get gzipped content?
22:47chewbran1athe readme on https://github.com/getwoven/clj-http says "The client transparently accepts and decompresses the gzip and deflate content encodings." but the content is still coming in as binary for me
22:53brehautchewbran1a: are you using clj-http.core/request or clj-http.client/request ?
22:53brehaut(or one of the verb specific wrappers in client)
22:55chewbran1abrehaut: clj-http.client/get
22:57brehautchewbran1a: version ?
22:58brehautchewbran1a: https://github.com/getwoven/clj-http/blob/master/src/clj_http/client.clj#L52-63 https://github.com/getwoven/clj-http/blob/master/src/clj_http/client.clj#L167
22:59chewbran1ahttp://pastebin.com/Qwd0G8JR
22:59chewbran1abrehaut: clojure 1.2 and clj-http 0.1.2
23:00brehautchewbran1a: ok. does it have a reasonable content type?
23:00brehaut(the page)
23:01brehauthuh it does
23:01chewbran1ayeah encoding gzip content type json
23:01chewbran1alooking at wrap-decompression right now
23:02brehautchewbran1a: i wonder if its not the gzip that is failing, but its not decoding the string correctly
23:04technomancyhiredman: I literally have a google image search for "so let it be written; so let it be done" open in my browser right now as I read what you said.
23:05technomancyhiredman: great minds think alike!
23:07chewbran1abrehaut: I just double checked, get basically the same output from curl: http://pastebin.com/5n7wDnu0
23:08brehautchewbran1a: im not an expert on curl, but i thought it handled gzip just fine
23:11chewbran1abrehaut: not sure, but it works fine piping curl to gunzip: http://pastebin.com/jhNeeT0J
23:11brehautchewbran1a: curious. unfortunately i have to get back to my actual dayjob
23:12chewbran1abrehaut: no problem, thanks for taking a peek
23:14technomancyit's really disappointing to me that there's no "motivational poster" style image of "so let it be written; so let it be done"
23:14technomancybut that's probably just because all the images of Yul Brenner as Pharaoh are in portrait orientation.
23:32xcvI'm having some trouble with leiningen; the project compiles just fine, but 'lein uberjar' hangs halfway through... Anyone seen this before?
23:34jlf`technomancy: http://wigflip.com/automotivator/
23:40xcv(I'm using Leiningen version 1.4.2)
23:41technomancyjlf`: powered by common lisp! nice. =)
23:42jlf`yeah, that's a xach production
23:43technomancyhttp://p.hagelb.org/so-let-it-be-written.jpg
23:44technomancyxcv: you probably have some side-effects in a top-level form. you want the code that's supposed to be run when your uberjar is executed to live in a -main function.
23:44technomancyxcv: also, why not run "lein upgrade" to get onto 1.5.2?
23:49xcvpretty awesome to get feedback from the creator so quickly! :)
23:50xcvthe top level -main function calls one function that produces side-effects
23:51xcvbut it still compiles fine...
23:51xcv(the side-effects are just IO statements, it's a compiler)
23:51technomancyoh right; hmmm... it pauses in the middle of "including foo..."?
23:52xcvthe output looks like this just before it hangs:
23:52xcvhttp://pastie.org/1814154
23:53xcvI can't see where it's stuck
23:53technomancyinteresting; it's running dependencies twice
23:54technomancydoes "lein jar" hang as well?
23:54xcvyes, seems to hang
23:54xcvshouldn't take this long, I think
23:55technomancyis the source public?
23:55xcvsure
23:55xcvit's a school project
23:55xcvI haven't shared it anywhere, but I could paste the code
23:56xcvhere it is
23:56xcvhttp://pastie.org/1814156
23:56xcvdon't let the Icelandic freak you out :P
23:57technomancyit's ok; I've read Journey to the Centre of the Earth.
23:57technomancyany dependencies?
23:58xcvright now, the end result is a bunch of println calls, which will be changed to file IO calls, but I was trying the project build anyway
23:58xcvhere's the project.clj file: http://pastie.org/1814158
23:59technomancywhere's SchemeLexer coming from?
23:59xcvthat's a java file in the root of the project directory
23:59xcv(by the way, Swank-Clojure is awesome)
23:59technomancyah, that wasn't really me