#clojure logs

2011-09-13

00:12sridis it possible to trace javascript errors (in browser) down to cljs source line no?
00:13amalloyseems unlikely, srid, but i guess i'm not the expert
00:23dnolensrid: not yet no, you need source mapping for that.
02:08antares_hi. I have a type hint inside a syntax-quoted form, like this: (String. ^bytes message-payload#) and compilation fails with "Unable to resolve classname: clojure.core/bytes". What do I do? without this type hint, String ctor cannot be determined.
02:15amalloy^"[B" should work
02:17amalloy^bytes is a convenience that i guess the syntax-quoting system might not know about
02:25antares_amalloy: thanks. I ended up with ~(with-meta v { :tag bytes }) where v is generated with gemsym.
02:29tsdhIs there a way to programmatically generate strings containing nested #=() forms? I want to generate something like "#=(+ 1 #=(+ 2 3))", but don't get it...
02:36tsdhAh, got it using format instead of str.
02:36ambroffanyone have any idea how to use into-array to create a byte[][]? I can't figure out how to name the byte[] type.
02:37amalloy&(class (into-array [(make-array Byte/TYPE 1)]))
02:37lazybot⇒ [[B
02:37ambroffI have a sequence of byte[] objects and I want to turn it into a two dimensional array so I can invoke a variadic method that takes byte[]… as a parameter
02:37ambroffoh thank you amalloy!
02:38amalloyreally though if you have a sequence of byte[]s, just a plain old into-array should work?
02:39amalloytsdh: i think chouser is right; trying to do a bunch of code evaluation in the reader is madness
02:40tsdhamalloy: Most probably he is right, but as long as I don't have a better solution...
02:52tsdhamalloy: This works flawlessly (http://pastebin.com/4QAhwJWp) and allows me to read and write arbitrary clojure data structures containing instances of those custom 2 java classes. Although not very clean, I don't see how to do it otherwise. But I'm still open for suggestions.
03:00thorwilhmm, if i start appengine-magic from a lein repl, i can use datastore ops fine. but via swank, after clojure-jack-in, i get: No API environment is registered for this thread.
03:24thorwilok, so i learned slime-eval-buffer and pasting to the repl makes a difference, there :)
04:03Jeffrey04good evening~
04:04Jeffrey04i just threw 10mil of lines into my script and it throws OutOfMemoryError (-Xmx2G), is there anyway I can rewrite the code so that it doesn't use up all the memory?
04:04Jeffrey04http://stackoverflow.com/questions/7186663/clustering-fkmeans-with-mahout-using-clojure < the first clojure script
04:05Jeffrey0410mil lines of input from stdin*
04:05Jeffrey04clojure 1.3-snapshot if this is relevant
04:12FossiJeffrey04: seems like something isn't lazy (prolly the java part)
04:13Fossiso it realizes the whole seq when trying to pass that on
04:13Fossiyou can try to force evaluation (doall) earlier to see what consumes too much memory on the way
04:14Jeffrey04Fossi: not sure, I don't even know where to begin debugging ;/
04:15FossiJeffrey04: i don't get the domain at all, but i assume you want to read some lines, crunch them and spit them out again then continue?
04:16kzarI wanted to fix a typo in a 4clojure problem but the source in Github seems to only go up to problem 87. Where's the latest version?
04:19Jeffrey04Fossi: it first turn the first block in the stackoverflow.com post into something like this: { tag_sit [image_a 0 image_b 1] tag_lorem [image_a 1 image_b 0] ...}
04:19Jeffrey04then it will continue processing them
04:20Jeffrey04suspecting the inner reduce call is killing the script
04:21FossiJeffrey04: so you want all the data in memory at once?
04:22Fossiwhat i meant above was: turn the inner reduce into a method, and test-call that with doall
04:22Fossiand see if that already fails
04:23Jeffrey04probably not, thinking of caching them into temp file
04:23Fossiso you know whether that "first" step already fails
04:24Fossibecause with "normal" evaluation all the seqs will be sazy
04:24Fossi*lazy
04:24Fossiand it will fail just at passing it down to java on realizing the whole map/reduce construct
04:27Jeffrey04ok
04:27Jeffrey04let me try
05:46fliebelDoes ClojureScript have its own channel and mailing list?
05:51fliebelAh https://groups.google.com/forum/#!topic/clojure/3b77dCMuvQs
05:54michaelr525hey
05:54fliebelmichaelr525: Hi
05:54michaelr525what's up? :)
06:03tsdhDo I see it correctly that in clojure 1.3 ^:dynamic vars rebound with `binding' will have the rebound value in all threads spawned in the dynamic scope of the `binding'?
06:06raekonly with clojure's own constructs, like 'future'
06:07tsdhraek: Of course, that's what I've used to test my assumption. :-)
07:16thorwilwhere does output from println end up, with a swank session started via clojure-jack-in?
07:18raekthorwil: for expression evaluated from the repl thread, they should end up in the repl. in other threads they end up at the top of the buffer called something with "swank" in it
07:19raekyou might want to do a (intern 'clojure.core '*out* *out*) in your repl
07:22thorwilraek: that did the trick, thanks!
07:23thorwilbefore, there was no output in the repl and wild mix of looging in *swank* (without print output)
07:26thorwilnow if server messages keep out of the swank repl, this might actually be worth the move away from running a lein repl for appenegine-magic/jetty plus swank
07:48bendlasI'm having an issue with connecting Eclipse + CCW to an external nRepl
07:48bendlasIt works, basically, but autocompletion throws an error
07:48bendlasanybody seeing the same, or knows how to fix?
08:11pphantafternoon - can anyone explain why :arglists metadata only appears after I call defn twice?
09:41tsdhWow, the canonical lazy fibonacci sequence example performs fife times faster than a straight-forward iterative java solution. http://pastebin.com/DwFqADLs
09:42tsdhWhy is that? Because clojure starts the calculation with longs and promotes to slower BigInt ops only later on?
09:43opqdonutI guess yeah
09:43opqdonuttry using BigInteger.ZERO and ONE instead of 0 and 1 in the clojure version and see what happens
09:47tsdhopqdonut: Hm, it's still as fast as before using 0N 1N...
09:49michaelr525compiler optimization maybe
09:49michaelr525i mean maybe it still compiles to integer
09:51tsdhOr clojure.lang.BigInt simply performs better than java.math.BigInteger.
10:05TimMcclojure.lang.BigInt... new in 1.3?
10:05TimMcyes, it is
10:06TimMc"unlike BigInteger, BigInt has consistent hashcodes with Long, through range of long"
10:11michaelr525cool
10:31leedadoesn't clojure core have a recursive merge for maps?
10:34michaelr525i found this: http://clojuredocs.org/clojure_contrib/clojure.contrib.map-utils/deep-merge-with
10:35michaelr525leeda: ^^
10:35leedabasically i want to do this: (merge {:a {:z 1}} {:a {:a 1 :b 1}}) -> {:a {:a 1 :b 1 :z 1}}
10:36leeda,(merge {:a {:z 1}} {:a {:a 1 :b 1}})
10:36clojurebot{:a {:a 1, :b 1}}
10:36leedamichaelr525: hm looks like it might work, wonder what function i should use
10:37michaelr525,(require 'clojure.contrib.map-utils)
10:37clojurebot#<RuntimeException java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate clojure/contrib/map_utils__init.class or clojure/contrib/map_utils.clj on classpath: >
10:37jliis there a way to turn off pull requests in github? hopefully people don't just think clojure is ignoring them
10:37michaelr525leeda: maybe identity
10:37leedasurprised there's nothing in clojure.core though
10:37jkkramer,(merge-with merge {:a {:z 1}} {:a {:a 1 :b 1}}) ;for one-level deep
10:37clojurebot{:a {:b 1, :a 1, :z 1}}
10:37leedamichaelr525: yeah i'll try that
10:37leedajkkramer: oh haha that works
10:38leedajli: wait why would you want to do that?
10:38jlileeda: because contributors have to sign a CA, and the channels for contributing are via JIRA
10:39leedajli: ah ok
10:39raekClojure has it's own issue tracking system and does not accept patches outside the system
10:39redingerjli: As far as I know we cannot turn off pull requests
10:39redingerOr at least, I don't see such an option
10:39jkkramerit lets you turn off issues, which may in turn disable pull requests
10:40redingerWe've turned off issues
10:41jkkramertoo bad github itself doesn't accept pull requests
10:44jliI guess someone would could just close them manually
10:45jliwith a link to the contributing page
10:47TimMcjkkramer: Isn't github on github?
10:47TimMcMaybe it is in a private repo.
10:47jliI don't think it is
10:48TimMcI guess they don't want people forking them.
10:48jliyeah, not publically at all
10:48jkkramergithub-the-company is, github-the-site is not
10:48jlipublicly at least*
10:48TimMcI think some of their components are public.
10:51hugodthe github wiki (gollum) is on github
10:55hugodoh, and I see they now have a github maven plugin, with goals for uploading artifacts to a project's download area on gihub, and to publish to gh-pages
11:49michaelr525anyone here uses ERC for IRCing?
11:50michaelr525how to get the number of people in the channel?
11:50Scriptorthere's some elisp script you have to install, it's not bundles afaik
12:01technomancymichaelr525: (hash-table-size erc-channel-users)
12:02technomancywhat I wouldn't give for a reasonable associative data structure in elisp =(
12:04hugodwhat rhickey hoped he'd never see? https://github.com/pallet/zi-cljs
12:09ambrosebshugod: he knew someone would do it ;)
12:10michaelr525technomancy: hey thanks!
12:10michaelr525err
12:11mdeboardWhy didn't he want to see that?
12:11mdeboardDoes it compile to JVM bytecode ?
12:11michaelr525technomancy: can i just eval it while in the irc buffer?
12:11mdeboardor?
12:11technomancymichaelr525: M-:, yeah. it's buffer-local.
12:11mdeboard@ hugod ambrosebs
12:11mdeboardoh, uh
12:11mdeboardI remember from the "introducing cljs" talk
12:12michaelr525technomancy: ok, i need you to hold my hand :) how do it do it?
12:13technomancymichaelr525: just hit M-: from the ERC buffer you want to count and enter the expression above.
12:13mdeboardwhat was it? no in-browser execution?
12:13hugodmdeboard: no, it just runs the clojurescript compiler - but it uses clojurescript, closure-compiler and the closure library from jars
12:13mdeboardhugod: Why is that negative? I don't get it, I guess, but want to :P
12:14technomancyhugod: anything would be an improvement over "be sure to set CLOJURESCRIPT_HOME before you do anything"
12:14technomancygives me flashbacks to hadoop =\
12:15hugodtechnomancy: I don't think you have to do that anymore - my patch to infer clojurescript_home from the script path was applied across the board, I believe
12:15michaelr525201 Origin Ocean Additional Currency 1 (null) ORIGIN_OCEAN_ADDON_CURRENCY 0 1 1 1 1 1 4
12:15technomancyhugod: oh good
12:16michaelr525technomancy: thanks
12:17hugodmdeboard: I don't think it is negative - just some people dislike maven…
12:17mdeboardhugod: Oh ok, thought you were referring to the distaste (iirc) for in-browser evaluation
13:15dbushenkoyou guys!
13:16dbushenko#lisp has only 345 users, while #clojure -- 347!
13:16mdeboardyeah that's how trends work :P
13:17dbushenkothis winter #clojure had just about 200-220 on the average
13:17dbushenkoclojure gains popularity!
13:18SergeyDhi, where is defmacro in 1.3? I got a strange error that about clojure.contrib.def/defmacro after I removed the clojure contrib jar. Though I do not use or require clojure contrib anymore
13:20SergeyDSorry, I was probably wrong
13:20SergeyDJust "defmacro" in REPL works
13:50mattmitchellIs there a nice alternative to this: (apply concat (map :id (map :records data))) => yields a list of ids from {:records [{:id 1}]} ??
13:50lazybotmattmitchell: Uh, no. Why would you even ask?
13:50mattmitchellwell hrm
13:51mdeboardlol @ smart-aleck lazybot
13:51amalloyheehee
13:51mattmitchelllazybot: How was I to know?
13:51mattmitchell:)
13:51TimMchaha!
13:51TimMcIt got me that time.
13:52TimMcmattmitchell: data is [{:records ...}] presumably
13:52amalloymattmitchell: do you mean [{:records [{:id 1}]}]? your (map :records) doesn't make sense otherwise
13:53mattmitchellamalloy: oh yes sorry
13:53mattmitchellhmm, bad example
13:53mattmitchellLet me think of another
13:54TimMcPerhaps you are looking for some kind of tree-walk thingum.
13:55TimMcHrm... maybe that's too general
13:55amalloy&(let [data [{:records [{:id 1}, {:id 2}]}] (for [{records :records} data, {id :id} records] id))
13:55lazybotjava.lang.IllegalArgumentException: let requires an even number of forms in binding vector
13:55amalloy&(let [data [{:records [{:id 1}, {:id 2}]}]] (for [{records :records} data, {id :id} records] id))
13:55lazybot⇒ (1 2)
13:56TimMcOh, there's that flatten aspect of for again.
13:56mattmitchellTimMc: yes something like that, extract a flat list of values for a certain attribute, where the attribute is in a nested structure
13:56TimMcmattmitchell: Looks like amalloy nailed it.
13:57mattmitchellOh I see. Yeah that's nice.
13:58mattmitchellamalloy TimMc thanks!
13:58TimMc,(inc amalloy) for reminding me that for can descend more than one layer
13:58clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: amalloy in this context, compiling:(NO_SOURCE_PATH:0)>
13:58TimMc&(inc amalloy) then
13:58lazybotjava.lang.Exception: Unable to resolve symbol: amalloy in this context
13:59amalloyTimMc: for is fantastic. i use it in like every other function
13:59TimMcamalloy: Sorry, you don't exist.
14:01mattmitchellwow, how does that "for" example even work? Need to dig into "for" now.
14:01TimMcmattmitchell: A for with n bindings is like n nested for loops.
14:02mattmitchellTimMc: So your list of bindings can reflect the nesting?
14:02TimMcYup.
14:03mattmitchellVery awesome
14:03TimMcEach binding can use the bindings before it. You can use it for recursive descent, like amalloy did, or cartesian products if the second binding doesn't use the first.
14:03mattmitchellNice, thanks
14:03TimMc,(for [a [1 2 3], b '[x y]] [a b])
14:03clojurebot([1 x] [1 y] [2 x] [2 y] [3 x] ...)
14:04mattmitchellAhh OK. Good example.
14:05amalloy&(let [items '[a b c]] (for [x items y items :when (not= x y)] [x y]))
14:05amalloyis another example of useful stuff you can do with `for`
14:05lazybot⇒ ([a b] [a c] [b a] [b c] [c a] [c b])
14:06TimMchaha, nice!
14:06mattmitchellCool
14:06TimMcVery readable.
14:06amalloy&(let [items '[a b c]] (for [x items y items :while (not= x y)] #{x y})) ; no duplicates
14:06lazybot⇒ (#{a b} #{a c} #{c b})
14:07amalloythat might be the first time i've ever wanted to use :while, though - i find :when and :let a lot more useful
14:21mattmitchellis there a nice way to know if a number falls within a given range?
14:22amalloy&(< 5 8 10)
14:22lazybot⇒ true
14:22amalloy&(< 5 22 10)
14:22lazybot⇒ false
14:22hiredman,(.contains (range 10) 8) ;; don't do this
14:22clojurebottrue
14:23mattmitchellhiredman: nice one :)
14:23amalloyheh
14:23mattmitchellamalloy: man, why does it always look so simple?
14:23amalloy,(contains? (range 10) 8) ;; much more efficient!
14:23clojurebotfalse
14:23amalloy(also wrong of course)
14:24pdk(doc contains?)
14:24clojurebot"([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."
14:24pdk:|
14:49kjeldahl`Anybody ready for a Congomongo question? git://gist.github.com/1214676.git
14:49kjeldahl`In essence enforcing a unique index and detecting when an insert fails.
14:50mattmitchellCurious about a more idiomatic way to do this, anyone have any suggestions? https://gist.github.com/1214682
14:51mattmitchellIt removes :rates items if the :total_rate falls outside the min-rate and max-rate
14:52amalloymattmitchell: i smell a for/when pattern...
14:52mattmitchellthat's what I was wondering
14:57amalloyi guess there are a number of ways you could do this
14:57amalloyhttps://gist.github.com/1214703 is a rewrite with for/when
14:58amalloyyou could also do something like...map over the collection with an update-in that fixes the :rates key, and then filter for non-empty :rates keys
15:00mattmitchellamalloy: Really nice, thanks! :)
15:05amalloyclojurebot: ping
15:05clojurebotPONG!
15:12zippy314_Hi. Looking for help interpreting the syntax of the cyclic load deps warning under 1.2.1: Cyclic load dependency: [ /anansi/streamscapes/streamscapes ]->/anansi/streamscapes/ident->[ /anansi/streamscapes/streamscapes ]->/anansi/streamscapes/channel->/anansi/test/streamscapes/channel
15:12zippy314_Am I supposed to read that backwards?
15:13zippy314_wondering what the [ ] mean.
15:33seancorfieldpastebin the use/require clauses from each of those namespaces for us to look at?
15:34scgilardi[ ] highlights the path that the loader attempted to load twice
15:35scgilardiit reads forward
15:36arohnerI have a clj file that takes 5-10s to compile in swank, when normally things take 0.01s. The file is not unusually long (50 LoC), but imports several java classes.
15:36arohneris there anything I can do about that? is it a known issue?
15:36amalloyarohner: it probably compiles in no time at all, then wastes a bunch of time printing status messages
15:36amalloytry (setq font-lock-verbose nil)
15:37arohneramalloy: no change. It takes 5s before the …….. shows up
15:40amalloydunno, then. maybe technomancy has seen it before
15:41grim_radicalhow would i test if a variable is a java array? i can't seem to find an array analog to things like coll?, string?, etc
15:41amalloy&(.isArray (class []))
15:41lazybot⇒ false
15:41hugodarohner: how are you compiling it in swank?
15:41grim_radicalamalloy: ah, of course...thanks!
15:41arohnerhugod: C-c C-k
15:42amalloy&(.isArray (class (into-array ["test"])))
15:42lazybot⇒ true
15:44mccraigi have a lazy-seq of vectors… is there a stdlib function that will give me a lazy-seq of the concatenation of those vectors ?
15:45chouser,(apply concat '([1 2 3] [4 5 6] [7 8 9]))
15:45clojurebot(1 2 3 4 5 ...)
15:45mccraigchouser: but that does not seem to be lazy…
15:45hugodarohner: have you tried calling load-file from the slime repl? is that what the 0.01s is?
15:45Chousukeit is
15:46chousermccraig: it should be "mostly" lazy -- not quite as lazy as it could be with a more specific function iirc.
15:46arohnerhugod: load-file takes 1s
15:46clojurebotI don't understand.
15:46Chousuke,(take 1 (apply concat (repeat [1 2 3])))
15:46clojurebot(1)
15:46mccraigchouser: it seems to evaluate the entire contents of my lazy-seq of vectors
15:47Chousukeas you can see, it doesn't :)
15:47Chousukeare you sure you're not forcing evaluation somewhere else?
15:47arohnerhugod: actually, it varies, 1s to 10s
15:47chousermccraig: it probably forces the first 2 or 3 steps of the lazy seq initially
15:48hugodarohner: lots of gc?
15:48Chousukehmm
15:48Chousuke,(take 1 (apply concat (repeat [(do (print "hey") 1) 2 3])))
15:48clojurebothey
15:48clojurebot(1)
15:49pcavs,doc repeat
15:49clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0)>
15:49Chousukehm, duh
15:49Chousukejust realised my experiment doesn't quite work .P
15:49Chousukeoh well
16:01mccraigchouser Chousuke : you are right… it is evaluating the first 3 steps of the lazy seq, and since the test seq only has 3 steps, i took that to mean it was evaluating all steps : thanks
16:13rata_hi
16:14rata_how can I specify the groupid of a package from maven central in project.clj?
16:15arohnerrata_: in dependencies [group-id/artifact-id "version"]
16:15rata_arohner: ok, thanks =)
16:24TimMcamalloy: ##(contains? (set (range 10)) 8) much better :-P
16:24lazybot⇒ true
16:24amalloynot nearly as efficient though
16:25TimMcYours efficiently returned the wrong answer.
16:25clojurebotllahna: anyway the answer is no. you can use #(some-fn %1 default-arg %2), for example
16:25amalloyTimMc: yeah, that was the whole fun of it
16:26amalloyclojurebot: llahna: anyway the answer?
16:26clojurebotllahna: anyway the answer is no. you can use #(some-fn %1 default-arg %2), for example
16:27amalloybrilliant
16:54TimMcclojurebot: yeah?
16:54clojurebotexcusez-moi
16:54TimMcwait, nvm
17:40arohneris it possible to ask for the list of all loaded classes? Does that make sense on the JVM?
17:41companion_cubeit may load the "list" class, hence modifying the observed state :)
17:42brehautarohner: looking at the ClassLoader (http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html) methods, it doesnt appear to be obvious if it is possible
17:42technomancyarohner: I don't think you can distinguish between classes that have been loaded vs classes that are just on the classpath
17:42technomancybecause it's supposed to be transparent
17:42amalloychouser: looks like data.xml is set up to be built by hudson, but the builds have been failing; is that accurate? i don't understand hudson
17:42joegalloif this isn't out of date: http://www.javaworld.com/javaworld/javaqa/2003-07/02-qa-0725-classsrc2.html
17:43joegallothen you might could wallhack that field and read it off the some of the usual suspect classloaders
17:43joegallobut that's not appropriate for, like, real code
17:43ieureIs there a way to create a thing like a Python generator with Clojure?
17:44arohnermy goal is to make a find-class that works similar to find-doc. I could deal with loading all classes, but I'd prefer not to
17:44arohnerthanks all
17:44brehautieure: do you mean a function that yields items one by one, or do you mean the iterable object that is returned by that function?
17:44joegallohttp://download.oracle.com/javase/6/docs/api/java/lang/instrument/Instrumentation.html
17:44joegallohas a getAllLoadedClasses() :)
17:44ieurebrehaut, Well, both, but I am more interested in the former.
17:45amalloyieure: lazy-seqs are isomorphic to generators, really, i think
17:45brehautieure: theres no direct analogy, but the lazy-seq macro is what you are looking for
17:45brehautamalloy: nah, seqs are superior in about every way to generators
17:46ieurebrehaut, It’s not clear from the docs that it is, but they are often difficult to grasp in their terseness.
17:46ieureThe docs make it seem more like it is memoizing.
17:47ieureSo basically I want to stitch together paginated results into a single seq.
17:47ieureBut I don’t know the offset of page N' until I have consumed page N.
17:47brehautieure: the big difference is that generators are iteratively defined, and lazy-seqs are recursively defined. inside a lazy-seq cons is roughly equivalent to yield in python
17:48technomancyieure: you may be able to even just (apply concat (for [...]))
17:48ieuretechnomancy, Maybe.
17:48ieurebrehaut, Interesting perspective.
17:48ieureI need to meditate on this.
17:48brehautieure: oh, there is one thing that generators can do that i dont think seqs support: generators can have a value 'sent' back into the generator function
17:49ieurebrehaut, Yeah. Though that is not something I need.
17:50ieureSo, if I create a lazy-seq that produces the results I want, does it: a) perform all the requests for pages the first time I begin to consume it, or b) perform the requests for page N as I consume across page boundaries?
17:50amalloybrehaut: explain
17:50amalloy?
17:50brehautamalloy: which part?
17:51amalloygenerators can have a value 'sent' back into the generator function
17:51hiredmanieure: it depends how you construct it
17:51ieureFrom the docs, it appears that A is the case, whereas I want B.
17:51hiredmanlazy seqs don't know anything about "pages" whatever those are, but if you construct it in a way that knows about pages then yes
17:53ieurehiredman, It’s unclear to me how I would do it. Can you point me to an example?
17:53joegalloit would be pretty misleading to call it a "lazy" seq if the answer were a, i think :)
17:53ieurejoegallo, Okay, but this is the only interpretation I can get from the docs.
17:53ieure"Takes a body of expressions that returns an ISeq or nil, and yields
17:53ieurea Seqable object that will invoke the body only the first time seq
17:53ieureis called, and will cache the result and return it on all subsequent
17:53ieureseq calls."
17:53ieureSounds like memoization, not lazy/infinite seq creation.
17:54hiredmanieure: what if the body is a cons?
17:54ieurehiredman, I don’t know, what if it is?
17:54brehautamalloy: heres a trivial example: def foo():\n a = True\n while a:\n i = yield 1\n\n
17:54ieurehiredman, Is a cons an ISeq or nil?
17:54hiredmanieure: well read that again with s/body/cons/
17:55brehautamalloy: i = foo()\ni.next() # => 1\ni.send(False) # => StopIteration exception thrown
17:55brehaut#python must be an extremely frustrating place
17:55ieurebrehaut, It’s not, really.
17:56ieureI just have not internalized the Clojure way as fully as I have Python.
17:56brehautieure: there must be a better way to post example code then.
17:58amalloybrehaut: btw, ; is equivalent to \n and makes the code a little more readable :P
17:59brehautamalloy: sure :P
17:59brehautamalloy: the indentation isnt very fun though
18:00amalloyi don't think i understand the send() yet. does that mean that the generator continues as if "yield 1" returned False?
18:00brehautyeah, the return value for yield is the result of send
18:00brehautit turns a generator into an annoying coroutine
18:31gfrederickshrm. I'm trying to run the clojurescript tests (script/test) and it wants a V8_HOME.
18:32gfredericksso I download and build v8 and set V8_HOME to that directory, and it says:
18:32gfredericksscript/test: line 9: /home/user/v8-read-only/d8: No such file or directory
18:33gfredericksoh I see v8 has a "d8" build target....
18:40sridmy web app works flawlessly with clojure-1.3.0-RC1, but what's with the "not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise" warnings?
18:40brehautsrid: you have *earmuffs* on a var name
18:41srid"Warning: *append* not declared dynamic [...]" <- that's a core function, no?
18:41brehautsrid: but havent added the :dynamic meta; *earmuff* var names indicate that they are ok to rebind
18:41sridah, i am yet to read upon on 'bindings'.
18:42sridbrehaut: maybe the "append" is coming from some other library, but the warning doesn't tell source location at all.
18:42brehautit like is
18:42brehauts/like/likely/
18:42lazybot<brehaut> it likely is
18:42brehauti dont know how to find out sorry
18:51patchworkhey #clojure, I just ran a lein deps and it is missing the [org.clojure/java.jdbc "0.0.3-SNAPSHOT"] artifact? I ran it yesterday and it was there. Any reason why it would go missing?
18:51seancorfieldyou need to specify the sonatype repo to pick up snapshots
18:52seancorfieldjava.jdbc is at 0.0.6 right now on maven central
18:52technomancyfrom what I understand snapshots aren't even guaranteed to stick around anyway
18:53seancorfield0.0.3-SNAPSHOT would be very old, so you may be right technomancy
18:54seancorfieldthe only snapshot i'm relying on right now is congomongo because we're a bit lax about making non-snapshot releases :(
18:55patchworkAha, gotcha. Thanks!
18:56patchworkI will update it
18:56patchworkI was going off the instructions for the heroku clojure install
19:03seancorfieldi'm surprised that refers to a snapshot (given that i had to do fixes to support postgresql for that)
19:03patchworkhttp://devcenter.heroku.com/articles/clojure-web-application
19:04patchworkpossibly the page just needs to be updated?
19:04seancorfieldyeah, i'll ping aaron about that
19:42sridwhy are the key/value pairs reversed in map destructuring? eg: (let [{x 2, y 5} {2 "hello", 5 "foo"}] [x y])
20:01amalloytechnomancy: i'm trying to upgrade to 1.3 but can't get either cake or lein to run swank properly. i assume someone's managed to do this already; what do i need to do? i've tried $ lein plugin install swank-clojure 1.4.0-SNAPSHOT, but still $ lein swank seems to have issues: https://gist.github.com/1215517
20:02hiredmancheck for old versions of swank in lib
20:02hiredmanbut that is actually a problem with contrib
20:02technomancyamalloy: I haven't tried 1.3 since ~alpha2, but I also haven't heard anyone else mention that
20:03technomancyswank does have some "let's use this contrib functionality if it's on the classpath" features
20:03hiredmansome dependency is transitively compiling clojure.contrib using 1.2
20:03hiredmanthen packaging up the classfiles which are not abi compatible with 1.3
20:04amalloyhiredman: yes, i haven't yet hunted down which of my deps depend on contrib; i was hoping to use swank to help me find them
20:04hiredmanwell, this is something that is aot compiled
20:04amalloymaybe mvn will tell me?
20:28seancorfieldQ about reflection warnings... Given this code: (let [c (.charAt "Hello" 2)] (println (type c)) (= c \l))
20:28seancorfield(= c \l) gives a reflection warning that equiv can't be resolved
20:29seancorfieldit prints Character (but String.charAt(int) returns char)
20:29bhenry,(let [c (.charAt "Hello" 2)] (println (type c)) (= c \l))
20:29clojurebotjava.lang.Character
20:29clojurebottrue
20:30seancorfield,(set! *warn-on-reflection* true)
20:30clojurebot#<IllegalStateException java.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set>
20:30seancorfieldbah
20:30bhenryah
20:31hiredman= is being inlined as (. clojure.lang.Util equiv c \l)
20:32hiredmanI doubt there is a Character, char overload for equiv
20:32hiredmanthat is rather unfortunate
20:32seancorfieldfwiw i tried (= c (Character. \l)) but that also complained it couldn't resolve equiv
20:33hiredmanoh whoops
20:33hiredmanchar, char
20:33hiredmancharAt returns a primitive char
20:35seancorfieldah my bad - \l is Character, c is char
20:35seancorfieldif i wrap c as (Character. c) it work
20:35seancorfields
20:36hiredmanyeah
20:36hiredmanequiv really needs overloads for every combination of all primitives and Object
20:39seancorfieldmaybe i'd do better working with code points instead...
20:43acuozzoHi, I've done some googling, but nothing's turned up. Is there a standalone clojure beautifier/formatter?
20:45technomancyacuozzo: not really
20:45dnolenacuozzo: Clojure has a pretty printer though I think someone really needs to do some work to make it print really well formatted Clojure source.
20:45dnolenacuozzo: it works well enough for macroexpansion in Emacs.
20:45acuozzoAh, OK. I was hoping to plug something into my editor (nvi -- the BSD-licensed vi clone).
20:46acuozzoThanks :-)
20:46technomancythe clojure.pprint is a start, but it's not usable out of the box
20:46acuozzoI suppose that it needs to be tweaked some?
20:47acuozzoAlso, I noticed the clojure-refactoring project on Github (I think it was Github, at least). Has anyone toyed with turning this into a standalone CLI refactoring tool?
20:51scottjacuozzo: nothing released. I think the non-elisp parts were extracted to parsley
20:51acuozzoIs parsley on Github?
20:52acuozzoYes, it is. Looking now
21:37drewolsonthis may not be the right place, but i'll take a shot: anyone know a good way to go about getting your clojars password reset? I sent an email a few days ago but haven't heard anything back.
22:50sridcould someone tell me where in this code is the compiler error "ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number" coming from? clojure compiler error messages are so unhelpful. http://dpaste.com/614485/
22:54dnolen,(+ 1 [])
22:54clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>
22:54dnolen,(<= 1 [])
22:54clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>
22:54dnolensrid: ^
22:55dnolensrid: that exception should give you a precise line number as well.
22:55sriddnolen: oh, yes, that's what I thought at first. but neither x nor n in `(<= x n)` are vectors.
22:56joegalloon the second recursive call (that is, the third call overall), x is a vector.
22:56sridn is always a number. and x cannot be a seq (because, it must be matched by the above cond)
22:56joegallo[3 [4 5] 6]
22:56joegallo(and then things blow up)
22:57dnolensrid: Clojure errors while initially cryptic are never wrong.
22:57joegallo,(seq? [1])
22:57clojurebotfalse
22:57dnolenonly two places in you program that error can happen line 15 and line 16
22:57joegalloa vector is not a seq, precisely. it is seqable. (or something like that)
22:57sridah
22:58sridso I should use (vector?) .. but I'd prefer to have a generic is-this-collection function.
22:58dnolencoll?
22:58clojurebotReader syntax of collections has gotchas
22:58dnolen,(coll? ())
22:58clojurebottrue
22:58sridreplace seq? with vector? made the compiler happy. no warnings.
22:58dnolen,(coll? [])
22:58clojurebottrue
22:59sridnice
23:00alandipertdnolen: are or-patterns and subexpr matching WIP?
23:00dnolenalandipert: no if those don't work, bug, example?
23:01sridwow, that program was correct after first run.
23:01sridall I had to fix was a compiler warning
23:01dnolenthe only serious bug I want to fix is the lack of backtracking.
23:01alandipertdnolen: examples in readme
23:01dnolenalandipert: ? they don't work?
23:03alandipertdnolen: or rather, the or-pattern example doesn't work because of an unrelated omission (no y and z)
23:03alandipertand the subexpr example doesn't work for me for reasons i don't yet understand
23:03dnolenoops typo thx, fixing now
23:04alandipert"as patterns" is the other one, i managed to work things out using the test as example
23:04dnolenanother typo
23:05dnolenalandipert: both fixed now
23:05dnolenalandipert: actually the second one isn't sorry
23:05alandiperti demand a refund :-)
23:08alandipertthe expansion demonstration under 'about' also doesn't work, but maybe doesn't need to
23:11dnolenalandipert: changed the about expansion wording
23:12alandipertcool, thanks!
23:14dnolenalandipert: you did discover a bug tho, vector patterns of different lengths don't work, thx for the feedback.
23:14alandipertno prob, i hope to one day come to you with an actual patch