#clojure logs

2010-09-10

00:16BahmanHi all!
00:17dakronehi Bahman
00:17BahmanHey dakrone
00:20Bahman'lein self-install' fails as if the URL doesn't exist. http://pastebin.ca/1937025
00:21BahmanI'd appreciate any idea/hint.
00:21lancepantzBahman: you're not the first person i've seen mention that today
00:22dakroneBahman: did you use the development version of the script instead of the stable one?
00:22Bahmanlancepantz: So they changed the script before they upload the jars?
00:22Bahmandakrone: I used the one on leiningen's homepage.
00:22lancepantzdunno
00:22dakroneBahman: the dev version points to 1.4.0-SNAPSHOT, the stable one points to 1.3.1, which actually exists
00:23Bahmandakrone: Thanks...now looking for 'stable version'.
00:23dakronehmm... okay, I see the windows one points at 1.4.0, and there's no difference
00:23dakroneyou could try editing the line "set LEIN_VERSION=1.4.0-SNAPSHOT" to "set LEIN_VERSION=1.3.1" in the script itself
00:23BahmanRight...let me try.
00:25Bahmandakrone: That works. Thank you.
00:25dakroneBahman: awesome, glad it worked
02:37pomykquit
02:50LauJensenGood morning all
04:07BahmanHi again.
04:43lenwmorning all
04:44lenwany pointers on using jms in clojure appreciated ?
04:46fliebel*googles jms*
04:53fliebellenw: http://xkcd.com/138/
04:54lenwfliebel: good one
04:54lenwfliebel: i have another system sending messages to a queue on activemq
04:55lenwfliebel: want to read them off and do sttuf with them, just curious if anyone has tips / gotchas from the clojure world
04:56fliebellenw: Not me at least, all I know is that Java interop is very straightforward most of the time.
04:56lenwfliebel: yes thank
05:02octe,(+ 1 1)
05:02clojurebot2
05:08fliebeloooh, I could write a lisp in python using generators. :) (discovered by accident, and it's going to be ugly)
05:11LauJensenZZZzzz
05:11LauJensen:)
05:44cm9Does anyone have an email address for Stuart Halloway? I just found an illegal (?) copy of his book online.
05:50LauJensencm9: Lets go private
06:00fliebelLisp in Python: http://news.ycombinator.com/item?id=1678367 (feel free to vote)
06:13raekis there any way to make C-c t in clojure(-test)-mode jump between src/foo/bar.clj and test/foo/test_bar.clj ?
06:16mrBlissraek: i've written a simple elisp function myself for this purpose
06:17mrBlissraek: http://github.com/mrBliss/dotfiles/blob/master/.emacs.d/clojure.el#L155
06:22raekoooh... neat! this should be included in clojure-mode.
06:23mrBlissyou might have to adapt it to your needs (docstring is quite clear)
06:42bartjif order doesn't matter, while adding elements to vectors, which is more preferable - conj or cons ?
06:42mrBlissconj
06:42bartj,(time (conj [10 20] 30))
06:42clojurebot[10 20 30]
06:42clojurebot"Elapsed time: 0.15 msecs"
06:42bartj,(time (cons 30 [10 20]))
06:42clojurebot(30 10 20)
06:42clojurebot"Elapsed time: 0.133 msecs"
06:43bartjcons, generally takes marginally less amount of time
06:43bartjmrBliss, may I ask why ?
06:43fliebelPleas hit me, to be sure I'm awake… My lisp is on the front of HN :) http://news.ycombinator.com/
06:44mrBlissbartj: 1 iteration is not enough make a conclusion
06:45LauJensenfliebel: 3rd place
06:45raekbartj: cons doesn't items to the vectors, it conses on items to (seq the-vector)
06:45LauJensen:)
06:45raek...doesn't add items...
06:45LauJensen,(time (dotimes [_ 1e7] (cons [10 20] 30)))
06:45clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
06:46fliebelLauJensen: Yea… goo enough for me… never had that before :) little blogger that I am.
06:46bartjfliebel, upvoted for you!
06:46raek,(assoc [:a :b :c] 1 :x)
06:46clojurebot[:a :x :c]
06:46LauJensenfliebel: I just mentioned it because I just upvoted you
06:46raek,(assoc (cons :y [:a :b :c]) 1 :x)
06:46clojurebotjava.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Associative
06:46fliebelbartj, LauJensen: thanks
06:47LauJensen-> (time (dotimes [_ 1e7] (conj [10 20] 30)))
06:47sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: ()
06:47LauJensen$mail Raynes -> (time (dotimes [_ 1e7] (conj [10 20] 30)))
06:47sexpbotMessage saved.
06:47LauJensen,(time (dotimes [_ 1e7] (conj [10 20] 30)))
06:47clojurebot"Elapsed time: 3141.638 msecs"
06:47LauJensen,(time (dotimes [_ 1e7] (cons [10 20] 30)))
06:47clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
06:47LauJensenah
06:48LauJensen,(time (dotimes [_ 1e7] (cons 30 [10 20])))
06:48clojurebot"Elapsed time: 3624.422 msecs"
06:48RaynesLauJensen: Licenser told me it was a bad idea to whitelist time because there is something else that I'd have to whitelist in order to whitelist it that would be bad to whitelist. I'll take a look later to make sure it's bad juju though.
06:48LauJensenSystem/nanoTime?
06:49LauJensen-> (System/nanoTime)
06:49sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: ()
06:49LauJensenRaynes: hiredman doesn't seem to be concerned
06:50RaynesLauJensen: I'm not entirely certain if I can whitelist a single method in a class without whitelisting the entire class.
06:50LauJensen,(System/exit)
06:50clojurebotjava.lang.NoSuchFieldException: exit
06:51LauJensen,(System/exit 0)
06:51clojurebotjava.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
06:51LauJensen,(System/nanoTime)
06:51clojurebot1284115898617708000
06:51LauJensenRaynes: If not, then Clojurebot wins
06:51RaynesIt's not a competition. I can only do what clj-sandbox lets me do. If that's less then what clojurebot can do, then there isn't much I can do about it.
06:51bartjraek, I am afraid I don't understand
06:52mrBliss,(map class [(cons 3 [1 2]) (conj [1 2] 3)])
06:52clojurebot(clojure.lang.Cons clojure.lang.PersistentVector)
06:52LauJensenRaynes: If not, then Clojurebot wins
06:52mrBlissbartj: conj returns a vector and cons a seq
06:53bartjok, so they are not comparable?
06:53bartjapart from the return type, both add elements
06:54mrBlisswith conj you keep the same data type
06:55mrBlissclear in my opinion
06:55mrBlisss/clear/cleaner/
06:55sexpbot<mrBliss> cleaner in my opinion
06:55fliebelbartj: I think the whole reason why conj adds to the end for some things and to the start for others is speed,
06:56raekcons only works with sequences, but calls seq on its second argument as a convenience feature
06:56LauJensenIts not so much about clean, but about picking the right datatype. A cons list is completely different from a vector, performancewise and interfacewise. It appends to the front where a vec append to the rear
06:56LauJensenUse the one which makes the most sense for your app domain
06:57mrBlissbut he said "if order doesn't matter"
06:57LauJensenThen how about speed?
06:57raekone can use conj, peek and pop to add and remove from the same end
06:58raekworks with both lists/sequences and vectors
06:58raekthat adheres to the last-in-first-out principle, though
06:58LauJensen,(reduce conj [] [1 2 3])
06:58clojurebot[1 2 3]
06:58LauJensen,(reduce conj '() [1 2 3])
06:58clojurebot(3 2 1)
06:59LauJensenVectors are optimized for that operation, lists aren't
06:59raek,(reduce conj #{} [1 2 3 2]) ; if only unique eelements needs to be distinguished
06:59clojurebot#{1 2 3}
07:01raek,(reduce (fn [m e] (assoc m e (inc (get m e 0)))) {} [1 2 3 2 2 3])
07:01clojurebot{3 2, 2 3, 1 1}
07:01raekif order is not important, but count is
07:01mrBlissraek: distinct is 10x faster on my system
07:03mrBliss,(time (dotimes [_ 1e6] (reduce conj #{} [1 2 3 2])))
07:03clojurebot"Elapsed time: 2670.621 msecs"
07:03mrBliss,(time (dotimes [_ 1e6] (distinct [1 2 3 2])))
07:03clojurebot"Elapsed time: 445.183 msecs"
07:04raekdistinct returns a seq, right?
07:04mrBlisstrue that
07:05mrBliss,(time (dotimes [_ 1e6] (set [1 2 3 2])))
07:05clojurebot"Elapsed time: 2450.42 msecs"
07:10mrBlisshaven't had a reply on this yet: http://groups.google.com/group/clojure/browse_thread/thread/24a105b12466a8e8
07:11LauJensenthats odd
07:11LauJensenGuess you should get a CA and push them into io yourself :)
07:12mrBlissno point if you and me are the only people who are gonna use it.
07:16LauJensenYour call, I think its useful
07:16@rhickeymrBliss: please make a ticket for that in Assembla - thanks
07:19mrBlissdo I have to send a CA?
07:21bartjjust asking, why does one have to "mail" a copy of the CA?
07:21LauJensenmrBliss: Not for making a ticket, but for contributing to either clojure/contrib you do
07:22bartjand not just fax it ?
07:22bartjor scan it and send it via email ?
07:24mrBlissok I started watching clojure on Assembla, but I still don't see how I can add a ticket. Do I have to be made member?
07:26LauJensenrhickey: RE mrBliss question, do you want this type of ticket under Support?
07:28@rhickeyLauJensen: the tickets end up in the same place
07:28LauJensenok
07:28mrBlissso I make one under support
07:28LauJensenyea
07:29bartjLauJensen, ?
07:30LauJensenbartj: rhickey made the system not me. I don't know why he doesn't take faxes, but emails are too anonymous I think.
07:31fliebelLauJensen: Would be nice to have the Amazon system where you enter a phone number which gets called and asks you to enter a PIN
07:31LauJensenfliebel: I think he wants your signature
07:33fliebelLauJensen: Hmmm, maybe connect a plotter to the other end that can be controlled by 8426? :P so you can remotely sign...
07:35mrBlissticket created
07:35cemerickbartj: scanned images by email are slightly dubious legally (at least in the U.S.). Faxes have full statutory force, but are irritating in a variety of ways. Plus, having a small hurdle is helpful in terms of ensuring at least some minimum degree of commitment.
07:36cemerickSuch reasons should be in a FAQ, as they absolutely fit the bill.
07:41bartjthanks!
07:41bartjI have signed TopCoder agreement statements before, and they allow one to scan the images and send them via e-mail
07:42bartjTopCoder is in the US and is quite reputed
07:42bartjbut, I understand the concerns, thanks!
07:42cemerickYeah, you can handle contracts by scans and emails (I do frequently), but paper with ink on it still has a privileged position.
09:11dnolen_haha, http://twitter.com/destructuring/status/24024973996
09:12LauJensenAh so Clojure is a Honda :)
09:14fliebelHm, put that in the contributors agreement in small print "I own a Honda"
09:24fro0gELEMENTary
09:24chouserouch
09:45shooverIs there a way to hold a lazy seq in an atom and essentially swap! it with rest without swap! trying to realize the whole seq?
09:46chouser(swap! atm rest) ... maybe I don't understand the question
09:47shooverI tried that, and I got a heap memory exception
09:47clojurebothttp://www.mindview.net/Etc/Discussions/CheckedExceptions
09:47chousershoover: did you try to print it afterwards, without a *print-length* set?
09:47shooverhmm... maybe?
09:48shooverchouser: ding ding ding
09:48shooverthe repl wants to print the atom
09:49chouserI wonder if the repl should have default values for *print-length* and *print-level*
09:49shooverhonorable mention goes to clojurebot for the enlightening link that I did not click
09:49chousersince we're making it all pretty now
09:49chousershoover: heh.
09:49LauJensenshoover: Could chunks be breaking you ?
09:50chouser'rest' ignores chunks
09:50LauJensen,(let [a (atom (map #(print %) (range 35)))] (swap! a rest) nil)
09:50clojurebot012345678910111213141516171819202122232425262728293031
09:50chouserooh, good point
09:51LauJensenyea I've had good teachers :)
09:53shooverLauJensen: true, although in my case it was just the repl trying to print the whole seq
09:53LauJensenk
09:56fliebelWhat's the name of that Clojure wrapper for generating music?
09:57shooverchouser: I wonder why there's not a default value for those vars already
09:57LauJensenshoover: That could lead to some lengthy debugging
10:00dnolen_fliebel: overtone
10:02shooverLauJensen: I hope that's a pun. Why would you rely on repl side effects to make your program work?
10:03LauJensenshoover: No no. I just dont want any program output altered without me asking for it specifically
10:03fliebeldnolen_: thanks
10:03shooverLauJensen: ok, yeah, it's more than the repl
10:09anonymouse89,(for [i (range 10)] '(inc ~i))
10:09clojurebot((inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)) (inc (clojure.core/unquote i)))
10:09anonymouse89hmm, how do I get ((inc 0) (inc 1) ...)?
10:10mrBliss,(for [i (range 10)] `(inc ~i))
10:10clojurebot((clojure.core/inc 0) (clojure.core/inc 1) (clojure.core/inc 2) (clojure.core/inc 3) (clojure.core/inc 4) (clojure.core/inc 5) (clojure.core/inc 6) (clojure.core/inc 7) (clojure.core/inc 8) (clojure.core/inc 9))
10:10anonymouse89ah, backtick
10:10mrBlissreplace the ' with a `
10:11sproustQuick question: is there a way to escape a newline character in a multiline literal string?
10:12sproust e.g., (def template "\ doesn't work.
10:12chousersproust: ah, excellent question! Thanks for asking. no.
10:13RaynesHeh.
10:13RaynesHow unfortunate.
10:13sproustAnd no reader macros means it could not be fixed by me here right now...
10:13chouserstring literals could use some work. I'm collecting notes for a proposal, and that's not an aspect I had considered, so I really appreciate you bringing it u p.
10:14sproustI'm converting some code from Python to Clojure, where the Python code was defining a lot of multiline "templates".
10:14chousersproust: why do you need it? you don't want to just let your editor wrap it visually, you want an actual newline in the code that doesn't end up in the string?
10:14chouseroh
10:15chouseryou can just put a literal newline in a string.
10:15sproustchouser: Look at the Python spec for string literals, lots of ideas in there. The PEPs are distilled discussions those guys had, and I think that for many topics the decisions can translate to LISPs.
10:15sproustchouser: I just don't want the first actual newline.
10:15chouserno need to escape it if you want the newline in the resulting string.
10:15RaynesWhen in doubt, you can always just (str ..) a bunch of strings together.
10:15sproustIt's the opposite, I want to prevent the first newline.
10:15chouseryeah, ok.
10:16sproustI guess I could define a macro that strips all the preceding and ending whitespace.
10:20sproustThanks!
10:22AWizzArdWeather forecast during Clojure programming in Emacs: http://julien.danjou.info/google-weather-el.html
10:22sproustSolved like this:
10:23sproust,(defmacro deftemplate [sym template] `(def ~sym (str preamble "\n" (s/trim ~template))))
10:23clojurebotDENIED
10:24RaynesGoogle has a weather API?
10:25RaynesGoogle has a thing about undocumented and unofficial APIs.
10:25dnolen_speaking of neat Emacs things when coding Clojure, http://briancarper.net/blog/568/emacs-undo-trees
10:27mrBlissmy clojure.el file: http://github.com/mrBliss/dotfiles/blob/master/.emacs.d/clojure.el
10:35shoovermrBliss: with lein commands, nice
10:36mrBlissa lot of it comes from other people's config files (like brian carper)
10:40sproustmrBliss: thx.
10:50apgwozmrBliss: i especially like the lein integration
10:50mrBlisssaved me at least 1hr since I started using it
10:56sproustQ: How do I create a regex that is not from a string literal? e.g. #(format "\b%s\b" word) wouldn't work, #(...) reader macro dispatches to lambda, not regex builder.
10:57mrBliss,(re-pattern "\\b%s\\b")
10:57clojurebot#"\b%s\b"
10:57sproustThx.
10:58sproustAh... was looking in contrib; it's core. Thanks.
10:58cemerickrhickey: I presume you've seen this? http://www.flickr.com/photos/paulbarry/2613013337/ :-D
10:59dnolen_man, another place where -> is really fun and useful is at the REPL, don't have to stop and think backwards.
11:00Chousukeheh
11:00ChousukeMy gut tells me -> is probably the most-used non-essential macro in Clojure :P
11:02cemerickIronically, the biggest changes to clojure are the ones that don't have tickets in assembla
11:03dnolen_Chousuke: I find it essentialy now, when looking into a data structure at the REPL (-> x :foo :bar 0) is cognitively faster and less typing than (get-in x [:foo :bar 0]), or (((x :foo) :bar) 0)
11:03dnolen_s/essentialy/essential
11:03Chousukednolen_: heh, yeah. I guess it's become a part of idiomatic clojure
11:03Chousukeit's surprisingly versatile
11:04dnolen_it's the best thing thing slice bread!
11:04dnolen_s/slice/sliced
11:04Chousukeand I've been evangelising its use over .. :P
11:05chouserChousuke: me too
11:05dnolen_"How I learned to stop worrying about parentheses and loved ->"
11:05chouserthough my big push to get .. removed or deprecated or discouraged was shot down completely.
11:06Chousukeheh
11:06ChousukeI suppose .. might have some use cases where it's still superior?
11:06ChousukeChains of static methods maybe?
11:07chouserit was explained to me that ..'s behavior was simpler to explain to java developers and would be more comfortable for them at first, compared to ->
11:07Chousukethat is true
11:08Chousuke-> is like "oh it it just transforms the expression recursively like <bzzzz>"
11:08sexpbotjava.lang.Exception: Unable to resolve symbol: is in this context
11:08chouseris it? I was more convinced that I would be unable to change rhickey's mind than I was that he was correct.
11:09ChousukeI suppose .. might also serve as a more intuitive example of what macros can do.
11:13weissji had difficultly wrapping my head around -> enough to really use it, except where i'd already written code and seen the parens stacked up at the beginning
11:14weissjor for ->> (or is it --> ? i forget), at the end
11:14weissjactually i still have this difficulty :)
11:17dnolen_weissj: try overusing them for a while ;)
11:18weissjdnolen_: i guess i have trouble realizing that I CAN use it until after i've already written something without it
11:18chouserthere are editor plugins to transalate back and forth. I'd love to try them out sometime
11:18weissjor perhaps i'll use it right away and then see i could go one or two levels of nesting further.
11:19weissjchouser: really? which editors? emacs?
11:19chouserI don't remember. probably emacs and maybe eclipse
11:20weissji am not sure how i would go about searching google for such a thing :)
11:21mrBlisshttp://github.com/tcrayford/clojure-refactoring
11:21weissjsweeeet
11:27raekthat's for emacs? then I have no reason not to try it
11:28@rhickeychouser: the easiest way to get me to change my mind is to show me I'm incorrect :)
11:29chouserrhickey: :-)
11:35chouserI guess I'll just have to find a java dev and see if I can explain -> to him
11:35chouserand ... send you a recording.
11:35@rhickeythen you'll have one data point
11:36fliebelchouser: What's with ->?
11:36chouserfliebel: I don't understand the question.
11:37fliebelchouser: Basically: I just dropped in, and was wondering what you're talking about :)
11:37chouser-> is a macro .. is also a macro
11:37sexpbotjava.lang.Exception: Unable to resolve symbol: is in this context
11:38chouser.. is older and because of other changes to clojure since then, -> can now do everything .. can do, plus more
11:39chouserso for the sake of simplicity of the language, I was suggesting phasing out the use of .. in favor of ->
11:39sproustIs there a way to "undefine" core macros like this, or somehow make them unavailable?
11:39sproustYou could create a "warnings-on-deprecated" mode.
11:40fliebelchouser: Sounds like a plan :)
11:40chousersproust: the issue is that rhickey doesn't think .. should be deprecated at all
11:41chouserand I don't care enough to try any more than I already have to change his mind.
11:42sproustHmmm, you could create a sane mode and turn it on, and share it for others with the same desire to use.
11:43chouserwell, I already don't use .. The question is more a cultural one. As long as .. remains sanctioned, some people will use it, and so everyone will have to learn at least how to read uses of it.
11:44chouserwhich is fine in this case. It's a very small issue.
11:46chouserhm, interesting.
11:46chouserwould work for any host objects I suppose?
11:47@rhickey(let [{.aLongName a .bLongName b} obj] ...)
11:48chouserI'm still such a sucker for syntax. :-P
11:48@rhickeychouser: yes
11:48slyruswhat would that do? locally set obj.aLongName to a?
11:49chouserslyrus: other way around -- set a local a to the value of (.aLongName obj)
11:49slyrusthen I don't like it :)
11:49@rhickeynot quite symbol-macrolet, but same difference as long as immutable
11:49slyrus{a .aLongName b.bLongName} would be more intuitive, to me at least
11:49slyrusb .bLongName that is
11:50chouseroh. heh. I just got that "yes" was a response to "any host object" not "I'm a sucker"
11:50@rhickeyheh
11:50AWizzArd*g*
11:51slyrus(let [{field-alias field-name ...} obj] ...) seems more consistent with (let [symbol value] ...)
11:52lpetitMy fear is that this could give the coder a wrong feeling of safety and operation atomicity (if not immutable)
11:52dnolen_rhickey: convenience for work in pods? :D
11:53@rhickeyslyrus: sorry, it would be other way round in syntax, (let [{a .aLongName b.bLongName} obj] ...)
11:53@rhickeylike for keys
11:53slyrusright
11:54@rhickeybut meaning still as chouser said, a is the value of (.aLongName obj)
11:54slyrusyes, as one would expect :)
11:54@rhickeylpetit: people working with mutable things should have a wrong feeling
11:54slyrusit's certainly more elegant than with-accessors!
11:54slyrus(or with-slots, I guess)
11:55ChousukeMaps might be getting a bit overloaded :/
11:55@rhickeyslyrus: right, although the symbol-marolet on which that is built is more general than this
11:55@rhickeylpetit: if anything, it can give one the nicer feeling of a snapshot of the values, vs repeated (.foo x)
11:56Chousukethen again, I can see how it makes sense to think of objects as maps with .fields as keys
11:56@rhickeyChousuke: that is associative destructuring, and so makes as much sense for fields, maps are just the syntax
11:56Chousukeright.
11:57lpetitrhickey: that's what I somehow wanted to say, and this snapshot feeling has nothing atomic if other threads are accessing the shared reference. But one could argue that the (bean) function also suffers from the same problem ...
11:57@rhickeylpetit: I really consider that a feature
11:57@rhickeycapturing a value
11:57lpetitrhickey: ok, starting to get used to it
11:59lpetitso (let [{a .aLongName} obj] ...) = (let [{a :aLongName} (bean obj)] ...)
11:59lpetitbut of course more succinct and performant
12:00@rhickeylpetit: not necessarily, I wasn't thinking about mapping to javabean getters
12:00@rhickeymore for fields of datatypes
12:01lpetitrhickey: oh ok
12:01slyrusrhickey: as distinct from entries in a map?
12:01@rhickeyyes, have types
12:01lpetitso what would that produced if used on a record ?
12:01@rhickeythus the destruring could yields primitive bindings
12:02@rhickeylpetit: in either case the destructuring could yield primitive bindings if the fields were primitive and the type of obj known
12:03lpetit:-/ I don't get "primitive binding" semantics
12:04lpetitnever mind, seems like an interesting feature after all
12:06@rhickey(let [{:keys [a b]} {:a 21 :b 2}] (* a b)) ;boxed arithmetic
12:06@rhickey(let [{:fields [a b]} some-obj-with-primitive-a-b] (* a b)) ;primitive arithmetic
12:07chouserrhickey: do you expect :inline to go away or at least be less used by core now that we have :static fns?
12:08AWizzArdoho, sounds good
12:08@rhickeychouser: yes, eventually
12:08chouserrhickey: do you plan to remove :inline as a feature then? I have used (abused?) it in contexts that :static doesn't address.
12:09AWizzArdI didn't follow the discussion, but is :fields destructuring a planned feature?
12:09@rhickeychouser: well, those contexts will still be there, as always deprecating isn't a first objective
12:09chouserok, thanks.
12:10@rhickeychouser: just like ..
12:10@rhickeywe can move forward without burning bvridges
12:10chouser:-)
12:16@rhickeyAWizzArd: not yet
12:18lpetitSay in ccw I have a correct file. I also have a running JVM environment correctly set, and entirely at the disposal of ccw for evaluating forms from the file. Say I don't yet have evaluated anything.
12:20lpetitNow the problem: the file has some interop forms, e.g. (.someMethod someOjb). Potentially deep inside a top level expression. Assume that clojure compiler is able to determine the class/interface for .someMethod (no reflection warning).
12:20lpetitNow the question: how could I make this information (the class) to ccw, so that when hovering over the method name I could present the javadoc for the method ?
12:21lpetitI don't mind potentially getting hands dirty by relying on some current implementation details. But I do not want the user to have to use a forked clojure.jar.
12:22@rhickeylpetit: until we have the compiler analysis phase as a separate utility, one approach is to use what you know about the imports
12:22@rhickeysince among the imports there are likely only a few (or one) methods with the same name
12:22chouserI don't think the compiler's analysis can be used without at least evaluating the imports, which can have side effects.
12:23lpetitchouser: I don't mind the side effects, would still work for 90% (or more) of the projects I guess (and I'll be using a dedicated CVM -Clojure VM- for this, not the one the user interacts with with his REPL)
12:27lpetitrhickey: granted, but the imports do not generally have to list all what is needed for interop, do they ? Or I would have to (macro-expand-all) the form I want to analyse, and then do the analysis myself (.foo called on obj obtained from .bar on baz obtained from function fun which has type hint yay ! And now back to analyse the number of arguments, and potentially analyse the types of the other arguments (if several overloaded met
12:28@rhickeylpetit: I'm not saying it's equivalent, it is what you can do today
12:28lpetitrhickey: ok, it was already somehow my "plan B" :)
12:30lpetitrhickey: "until we have the compiler analysis phase as a separate utility". How far in the future might that be ?
12:30AWizzArdrhickey: Are Pods a candidate for 1.3?
12:31lpetitor at least what should I expect the unit of the answer be ? months ? years ? :-)
12:31@rhickeylpetit: that depends upon volunteerism
12:31@rhickeyAWizzArd: maybe
12:31lpetitrhickey: oho :)
12:32@rhickeylpetit: obviously I'll be involved with cinc, but I'd like to have a set of people dedicated to the project, not only for the assistance, but also to ensure more widespread knowledge when we're done
12:32lpetitrhickey: is it worth doing this before cinc ?
12:33chouserlpetit: Once the october conferences are past (or at least my prep work for them), work on cleaning up the output of the analysis phase is at the top of my list.
12:33@rhickeylpetit: it is cinc
12:33lpetitchouser: those are great news
12:33chouserI've started it, but it's not far enough along to be a topic of the conj, so it's been pushed down my list a bit.
12:34chouserlpetit: don't get too excited though -- there's both significant engineering work and significant political work before that phase can be called "done"
12:36@rhickeypolitical work?
12:38chousereven in the little bit of converstions from compiler pojos to records I've done, I've made decisions that seem pretty arbitrary and that you or others may disagree with.
12:38lpetitchouser: I've nothing done for ccw in this area yet, and I'm pondering whether I do nothing right now (waiting for "compiler analysis phase as a separate utility"), or if I do the "do your best from the imports" stuff for the mean time
12:39chousersince the whole point (to me, at least) is a tree that everyone (rhickey, back-end emitter writers, IDE plugin writers, etc.) is happy with, I assume it's going to take some effort to iron that all out.
12:40lpetitYou'll soon regret the "good old days" of writing the book :-p
12:41chouserheh. doubt it.
12:41lpetitBeware the political works :)
12:41lpetitMust leave, cu
12:42raekis partial evaluation something that has been discussed/mentioned/thought about for cinc?
12:44@rhickeyraek: what do you mean by that?
12:45raeksimplifying expressions where some values for some variables are known
12:45duncanmhmm, i can't think of a good way to yield a seq of all directories under some common root easily...
12:45chouserduncanm: recursive, or just that one level?
12:46raekso that one can write general code that can be transformed into specific code
12:46@rhickeyraek: sounds like optimization HotSpot might do for us
12:46duncanmchouser: recursive
12:46duncanmchouser: the solution might be useful to add to clojure.java.io
12:47mrBlissduncanm: file-seq
12:47duncanmmrBliss: where's that from?
12:47mrBlissI think clojure.core
12:47duncanmoh nice
12:47raekmy Lisp professor did his doctoral thesis on partial evaluation, so I have heard some very interesting things about it
12:48chouser(filter #(.isDirectory %) (file-seq (java.io.File. "/tmp")))
12:48duncanmsweet
12:49raekbasically, a partial evaluator could turn an interpreter for a language into a compiler, if I have understood things correctly
12:51raekI should really read "A Program Manipulation System Based on Partial Evaluation" (Anders Haraldsson, 1977) some time (I have a copy!)
12:59cemerickraek: I remember rhickey talking about adding (app ...) as a shortcut for (partial apply ...)
12:59cemerickThat's a faint thing compared to what you're referring to though, I think.
13:30cemerickA Clojure "Scholarship": Let's send Raynes to the Conj! http://bit.ly/9dmeDe
13:30cemerickEveryone check out the above, please. :-)
13:43maeis there any way to force a lazy seq produced by 'str' into a Java String? I am having trouble feeding text html from enlive -> flying saucer/itext pdf
13:45cemerickmae: str doesn't produce a lazy seq, it always produces a java String.
13:45cemerickdo (apply str some-seq) if you want to stringify any seq
13:46maeok this is a point of confusion for me
13:46maestr isn't smart enough to do this without apply
13:46maebecause apply takes a collection and applies it to a function as each item in the coll being an arg
13:47maeaccording to 'str' documentation: With one arg x, returns x.toString()
13:47mae.toString returns a seq
13:47maeheh
13:48cemerickno, .toString doesn't return a seq
13:48cemerickyou're probably looking at a string representation of a seq, which you're thinking *is* a seq
13:48cemerick,(str (range 5))
13:48clojurebot"clojure.lang.LazySeq@1b554e1"
13:48cemerickbah
13:48cemerick,(str [1 2 3])
13:48clojurebot"[1 2 3]"
13:49cemerick,(apply str [1 2 3])
13:49clojurebot"123"
13:49maeyeah
13:49maeexzactly
13:49maethat .toString implementation has caused me major headaches in the past
13:49maeheh
13:50maehow it returns info instead of the string itself
13:50technomancy,(pr-str (range 3))
13:50clojurebot"(0 1 2)"
14:07ohpauleezRaynes is only 16?
14:07ohpauleezthat's out of control
14:22jfieldsis there a fn x where (x odd? [1 2 3 4]) returns [[1 3] [2 4]] ?
14:23Raynesohpauleez: :p
14:24ohpauleezI started writing common lisp when I was 16 or 17, but I wasn't able to sling it until 18 or 19
14:28KirinDavejfields: Yes.
14:28KirinDavejfields: (separate f col) in seq-util.
14:28jfieldscool. thanks.
15:01ninjuddjfields: you could also use group-by
15:01ninjudd,(group-by odd? [1 2 3 4])
15:01clojurebot{true [1 3], false [2 4]}
15:02jfieldsninjudd, good point, cheers.
15:05_habnabitSo lazy-seq is utterly baffling me. Is there a good explanation of it somewhere?
15:10chouser_habnabit: have you seen http://clojure.org/lazy
15:11_habnabitYes.
15:13_habnabitIs there a simpler example of it somewhere, maybe?
15:14cemerickThank you to everyone who donated. Raynes is going to the conj. What you've helped to do – so quickly! – is amazing. http://bit.ly/aj0XPr
15:16kencausey_habnabit: so is your confusion about how to use it?
15:17kencausey_habnabit: or is it about lazy sequences and why they are useful? Or?
15:17_habnabitNo, I understand what the benefit of lazy sequences is.
15:17_habnabitI just don't see how I'd use lazy-seq to write one.
15:19ohpauleezcemerick Raynes: Happy I could help! I love this community
15:19Raynesohpauleez: I'm very, *very* appreciative.
15:19ohpauleezhappy hacking man, just doing my part
15:21kencausey_habnabit: Just wrap some code whose last results is a sequence in (lazy-seq ... )
15:21kencauseys/last results/last result/
15:21sexpbot<kencausey> _habnabit: Just wrap some code whose last result is a sequence in (lazy-seq ... )
15:23chouserbut lazy-seq only wraps a single step
15:24_habnabitI mean, I see how you can write lazy sequences with next/rest/seq.
15:25_habnabitBut I don't know how lazy-seq fits into that.
15:25chousernext/rest/seq are for consuming or walking a lazy seq. lazy-seq is for creating one
15:25kencauseychouser: are you refering to the guarantee to only execute the body once?
15:26chouserkencausey: no.
15:28chouser,(class (lazy-seq '(1 2 3)))
15:28clojurebotclojure.lang.LazySeq
15:28_habnabitOh I see.
15:28chouser,(class (rest (lazy-seq '(1 2 3))))
15:28clojurebotclojure.lang.PersistentList
15:28_habnabit,(class '(1 2 3))
15:28clojurebotclojure.lang.PersistentList
15:29_habnabitAha.
15:29chouserlazy-seq only makes the one step lazy. "rest" returns the rest which in this case is a regular list again
15:29chouser,(rest (lazy-seq '(1 2 3)))
15:29clojurebot(2 3)
15:30kencausey,(class (rest (lazy-seq [1 2 3])))
15:30clojurebotclojure.lang.PersistentVector$ChunkedSeq
15:30_habnabitSo to make the entire sequence lazy, you have to reapply lazy-seq every time?
15:31chouseryes
15:31arohner_habnabit: typically, you build the lazy sequence with recursive calls to lazy-seq
15:33chousera lazy-seq of a cons whose first is something interest and whose rest is a recursive call to something that returns a lazy-seq
15:33chouser,(take 10 (repeater 5))
15:33clojurebotjava.lang.Exception: Unable to resolve symbol: repeater in this context
15:33chouserer
15:33chouser(defn repeater [x] (lazy-seq (cons x (repeater x))))
15:34_habnabitAhh.
15:34_habnabitI get it now.
15:34chouseryay!
15:42shooverif you want a lazy seq with none of the benefits, you can use this: (defn redundant [coll] (lazy-seq (if (seq coll) (cons (first coll) (redundant (rest coll))))))
15:52mrBlissRaynes: could it be that your site is down?
15:53sthuebnerRaynes: Many congratulations for you! I just noticed it some minutes ago via Twitter. Awesome funding. The trip is proboably going to MUCH fun!
15:54Raynessthuebner: It certainly is.
15:54RaynesmrBliss: Looks to be so. Odd.
15:54sthuebnerMeeting all The Guys in person.
15:54mrBlissRaynes: just read your thank you post 5 minutes ago. Congrats!
15:57bartjsthuebner, twitter status link, please ?
15:57bobo_yes Raynes gz!
15:58RaynesI'm not sure why the site went down. It's a brand new site, for one. And it certainly isn't wordpress.
15:58sthuebnerbartj: hold on! my twitter client of choice doesn't provides those http things. I'll get it for you, though
16:00sthuebnerhttp://twitter.com/disclojure/status/24129244595
16:00sthuebnerhttp://twitter.com/clojure_conj/status/24128533660
16:01sthuebnerin the days of bit.ly et al, these long URLs look weird
16:05RaynesmrBliss: Heh. I was using Habari rather than Wordpress because I was trying to avoid having to run mysql. First post and habari has already failed me. ;)
16:09RaynesmrBliss: I got it back up: http://blog.acidrayne.net/thank-you-for-sending-me-to-the-conj. CGI processes crapped out, I guess. Probably tried to handle too huge a load.
16:10cemerickRaynes: looks like you're comment-form-less :-)
16:11Raynescemerick: First blog post. Habari is probably a disaster. It certainly hasn't earned anything in my book yet.
16:11RaynesEverybody ends up throwing up Wordpress in the end. I'll likely be no different.
16:11cemerickRaynes: wordpress.com is phenomenal IMO
16:11RaynesIndeed. I just wanted to avoid MySQL.
16:11cemerickHosting wordpress is a cluster, but they seem to know how to handle their own kit, thankfully.
16:12ninjuddanyone here use jekyll?
16:13j0niwin 4
16:13Raynescemerick: I'm anal about memory usage on my VPS, especially with sexpbot and mongo and other crucial processes taking nearly 500mb of it. I have 1gb guaranteed and another gig of burst though, so I shouldn't worry so much.
16:13ssiderisninjudd: I've looked at jekyll a bit...
16:13cemerickRaynes: Specs are never an issue with wordpress, security is.
16:14cemerickI've never (knowingly) had an exploit hit me, *except* when I ran wordpress years ago. It hasn't changed, as far as I've heard.
16:14Raynescemerick: MySQL is a memory whore though.
16:16Raynescemerick: Indeed. The lack of the comment form is embarrassing. Going to set up wordpress immediately. :p
16:20ninjuddssideris: i keep planning to try it out, but my lack of CSS/desgin skills keeps getting in the way
16:21ssiderisninjudd: it's nice, I'm planning to use it with org-mode
16:22lancepantzit would be cool to have a static blog engine in clojure
16:22bartjRaynes: I am very happy and thrilled for you
16:22ninjuddRaynes: http://disqus.com/ is an interesting option for adding comments
16:22Raynesbartj: Thank you. :)
16:23ninjuddi think there is a wordpress plugin too
16:23Raynesninjudd: Indeed it is.
16:23bartjI have also found the community *the* best of all the communities so far - I was a member of a few.
16:24bartjBut this has been the best one - every time I drop in here, you guys bend backwards to help. Thanks everyone!
16:24bobo_i like the jekyll on github thingy. very simple and smooth
16:26bobo_dont understand at al why people seem to like to host their own blogs so much
16:30hamzalancepantz: there is one, http://github.com/nakkaya/static
16:31lancepantzhamza: cool, thanks for the link
16:31apgwozi may simply be missing it, but is there a function in core/contrib to search for X in a collection and return the index?
16:32hamzalancepantz: np
16:33apgwozcontains? is the closest thing i can find, but it returns bool
16:36kencauseyhamza: Joy of Clojure 5.7
16:37kencauseyoops s/hamza/apgwoz/
16:37kencauseywhich doesn't mean there is not one in contrib, as I don't know contrib really at all yet
16:38apgwozkencausey: if i can access my pdf copy of joy of clojure i'll take a look at it
16:38apgwozi've search clojuredocs.org (which is awesome) and haven't found anything. so it's either hiding really good or doesn't exist
16:38apgwoz... or i'm silly and missing something blatantly obvious
16:38apgwoz:)
16:39wwmorgan,(first (keep-indexed #(if (= :c %2) %1) [:a :b :c])) ; apgwoz
16:39clojurebot2
16:40cemerickAlso FYI: http://bit.ly/blAj1J I guess I'm full of news today :-)
16:40apgwozwwmorgan: yeah, i know i can regroup the sequence in some way, just seemed like there had to be a simpler way
16:40apgwozduly noted though
16:41cemerickLooking forward to working with KirinDave :-)
16:41wwmorgan apgwoz: the function seems a little underspecified. What do you do when the element doesn't exist, or when it appears multiple times, or the collection is unordered, etc
16:42lancepantzcongrats cemerick
16:42apgwozwwmorgan: all valid points, but conventions in other languages seem to be return -1, and don't support unordered things.
16:42apgwoznot supporting unordered things is sort of hard i guess in clojure
16:42apgwozgiven the collections framework
16:44alpheuscemerick: congratulations. Didn't O'Reilly say for years that they wouldn't consider any Lisp books?
16:44wwmorganapgwoz: maybe what you want most of all is a function that maps the elements of a collection to their first appearance. Then you can use the output of that as a function from elements to indexes
16:45wwmorgan* that is, the index of their first appearance
16:45apgwozwwmorgan: let's simplify it
16:45apgwozi have a vector.
16:46cemerickalpheus: Yeah, it's in their submission guidelines :-)
16:46cemericklancepantz: thanks :-)
16:46technomancycemerick: congrats. wonder if a better name could be chosen though; right now there is only one Clojure book of three that doesn't have P and C as its initials.
16:46technomancywe don't want to get in a situation like Programming Scala
16:47cemericktechnomancy: yeah, it's certainly not a perfect title. We're deferring to their sales org on that one to a large extent.
16:47technomancybobo_: it takes less time to write your own static site generator than it does to learn a system like jekyll IME
16:48cemericktechnomancy: Hopefully it'll end up just being called "The Lizard Book" (or whatever animal we end up getting). ;-)
16:48technomancythat works
16:49technomancyI guess that's probably what they call the O'Reilly Scala book too
16:50apgwozwwmorgan: regardless, keep-indexed will work, thanks
16:51datkaHas O'Reilly used snakes for any books?
16:51datkaif not, a snake would be a good fit for Clojure
16:52wwmorganagpwoz: cool! In case you want to front-load the searching process, you can do it this way: http://paste.lisp.org/display/114429
16:52defncongrats Raynes on getting the leg up on clojure-conj
16:52defncan i be your chaperone? :)
16:52cemerickdatka: I'm certain of it. Surely there's a python book with a snake :-)
16:53datkacemerick: eh, you're probably right.
16:53defnchas, you're a good guy for doing that btw
16:54Raynesdefmacro: Absolutely. :p
16:54defnwe have a defmacro in here now? heh
16:55lancepantzlol
16:55defnnow i feel like small potatoes
16:57alpheusspeaking of books, is Joy of Clojure likely to come out in Kindle format?
16:58kencauseyKindle doesn't handle PDFs?
16:58lancepantzdefmacro should only speak in forms evaled by the bot
16:59lancepantzi want a kindle, does it not read pdf's?
16:59defnIIRC you have to send them to your device through Amazon
16:59ohpauleezcemerick: Just saw the news man, congrats
16:59defnwhich costs money
16:59technomancydefn: no, it's free
16:59ohpauleezDefinitely looking forward to the read. Holler if you need extra technical proof-readers
17:00defntechnomancy: ah my mistake
17:00alpheusSorry, I'm an idiot. Didn't know a pdf was available.
17:00technomancymanning is not very good about providing alt. ebook formats though
17:00lancepantztechnomancy: but you can load pdfs, right?
17:00technomancyoreilly and prags are much better at that
17:00cemerickohpauleez: Heh, thanks. :-)
17:00defnpragprog rules
17:00defnepub FTW
17:01technomancylancepantz: IIRC later kindle revs support it w/o translation, but I have an (awesome) 1st rev.
17:01lancepantzah
17:01technomancyno stinkin' d-pad for me
17:02kjeldahlSimplest way to (println "abc") to stderr anyone?
17:04shoover(binding [*out* *err*] (println "abc"))
17:04ohpauleezisn't there a short hand for that?
17:04kjeldahlshoover: thanks
17:05defnohpauleez: you could write one pretty easy :)
17:06ohpauleezwith-out-str
17:06ohpauleezcan you do that, with out set to *err*
17:06defni like the binding form above more tbh
17:06defnfor that sort of thing
17:06ohpauleezor does it create brand new writer?
17:07defnyeah
17:07ohpauleeznvm, docs say it's the latter
17:07defnit does
17:08defnwith-out-str is for (let [foo (with-out-str (println "9000"))] foo) type tuff
17:08defnstuff
17:09ohpauleezright right
17:09ohpauleezmy b
17:09defnhow dare you!
17:09defn:D
17:10defnoh god -- AC/DC - Shoot to Thrill just came up in my iTunes. Someone remind me to prune my iTunes library at some point in the near future.
17:10lancepantznothing wrong with that
17:10technomancyif that's your worst embarassment you're in pretty good shape
17:10defnoh no there are worse ones
17:11defnAce of Base for one
17:11Raynesdefn: So you're going to the conference? I'm totally psyched to meet you. :D
17:11defnRaynes: I'm really going to try, but it's going to be tough
17:11defnI just quit my job to go back to school full time and am going to be struggling to make it to Strange Loop as it is
17:12RaynesI hope you make it. :)
17:12ohpauleezdefn: We'll have an intervention
17:13defnRaynes: I wonder if I can solicit donations because I'm an out of work 25 year old?
17:13Raynesdefn: If not for what transpired today, there would have been absolutely no chance of me going.
17:14defnYeah that was good to see though -- You spend an ungodly amount of time on Clojure
17:14defnyou deserve to be there for clojure-conj 1.0
17:14ohpauleezI absolutely love this community
17:14Raynes:)
17:15defnah crap my wireless mouse just died :(
17:15defnRaynes: you're making out like a bandit, first I send you a hard drive and now this! :D
17:16defnyou should tell everyone you have a serious illness and need $ for treatment, then flee the country
17:16RaynesI'm the king of charity.
17:16RaynesNot that that is a good thing.
17:16RaynesHeh, that could work.
17:18defnthe only problem with charity is that im not usually on the receiving end of it
17:18defni suppose that's a good problem to have in general
17:18defnbut i digress
17:20defnRaynes: whatcha been working on lately, anyway? ive been out of the loop for months
17:21defnyou were working on the github clj stuff, and sexpbot, any new stuff?
17:21defncemerick: congrats on the book!
17:22RaynesThe github bindings are pretty much complete save for some bugs I might not have found.
17:22Raynessexpbot and irclj are what I've primarily been working on lately.
17:22cemerickI don't think today was charity. I was mostly sincere about calling it a "scholarship" -- the quotes only there because there's no "real" school involved.
17:22RaynesA little web side project as well, but less attention it lately.
17:23cemerickdefn: Thanks :-) Here's hoping KirinDave and I manage to make a dent.
17:23defncemerick: ah sure, didn't mean to characterize it as "charity" in the derogatory sense
17:23Raynescemerick: You're mah bestest buddy evar.
17:23RaynesI was the one that used the term 'charity'.
17:23cemerickdefn: Oh, I wasn't inferring anything negative about it at all.
17:24defnwell there is that sense of 'charity' which is sort of a classist "he needs charity" (in a haughty tone)
17:24ohpauleezyeah, I've been out of the loop for awhile too, anyone working on something that hasn't come through the mailing list?
17:24cemerickBut I think of charity as a fundamentally disconnected act: dropping $50 into an amorphous org like the United Way, etc., and not really knowing what comes out the other end.
17:24ohpauleezI've got a little routing utility for aleph that I haven't put up yet
17:24cemerickThis was very personal, and very direct. Boggled my life-significance meter a little.
17:25defncemerick: how so
17:26cemerickdefn: We all know each other in some smaller, some larger ways, and we have at least one common bond. This was "in the family", to a certain extent.
17:27cemerickNow, as I think about it, "charity" could be organized like that, but it usually isn't. One often needs to look hard to see where your money or efforts have produced a difference.
17:28cemerickman, the problem with wordpress themes is that you can tell they're wordpress themes :-)
17:28defn:D Oh wordpress..
17:28chousercemerick: yeah
17:29Raynescemerick: Indeed. I'm looking through them right now.
17:29defnposterous FTW
17:29RaynesAlso, http://blog.acidrayne.net/?p=4
17:29cemerickdefn: bleh. They were very disappointing for me. Very feature-poor compared to WP.com. *shrug*
17:30defnYeah -- guess it depends on which features you need
17:31defnWhat's the big feature draw with WP if you dont mind me asking? I always found all of the features sort of annoying...
17:32Raynescemerick: Can you edit wordpress comments by other people?
17:32cemerickif it's on your site, sure
17:33RaynesCould you change that link I posted to http://blog.acidrayne.net/?p=4 for me?
17:33cemerickah, sure
17:33RaynesThanks!
17:34cemerickRaynes: was there only one?
17:34RaynesOnly one comment? Yes.
17:41defnwhich ring from clojars should I be using with 1.2.0?
17:42defnnevermind
18:19lancepantzdnolen: you around?
18:21apgwozis there a function that enumerates a sequence in core/contrib? i wrote (defn enumerate [coll i] (lazy-seq (cons [i (first coll)] (enumerate (rest coll) (inc i))))) which works fine.
18:26AWizzArdapgwoz: (find-doc "enumeration") ==> enumeration-seq
18:28apgwozAWizzArd: that's for working with Enumeration types
18:29apgwozbasically i want (enumerate ["hello" "world"]) => ([1 "hello"] [2 "world"])
18:29apgwozthe function above does that
18:30MayDaniel,(indexed ["hello" "world"])
18:30clojurebotjava.lang.Exception: Unable to resolve symbol: indexed in this context
18:31tomojit's in c.c.seq-utils
18:31apgwozyes!
18:32apgwozfound it
18:32apgwozwas looking for the wrong name
18:32apgwozthanks
18:38kawas44Hi
18:39kawas44I have a question about concat many lazy-list when generated by a map for example, anyone can help me on this ?
18:40AWizzArdbest you just ask directly :)
18:41technomancyclojurebot: anyone?
18:41clojurebotGabh mo leithscéal?
18:41technomancyclojurebot: anyone is <reply>Please do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help.
18:41clojurebotIn Ordnung
18:42kawas44I use a function like read-line in contrib : open file, lazy read lines, close file If I read-line two files and concat the result it's ok, but if I want to do more with map I get lists in list ...
18:46kawas44see I want to read many big files as one big lazy stream of lines, but instead of writing my own lazy-list I want to reuse contrib's read-lines
18:47AWizzArdkawas44: you can try mapcat instead of map
18:49kawas44AWizzArd, because my logfiles can be very bing I want to keep the reading lazy, but I'll try mapcat right now :)
18:51rickmodeAnyone using sandbar? I'm wondering if it offers enough today to warrant usage as opposed to DIY.
18:52iris1.
18:53kawas44Thanks AWizzArd, look like it work for my small test files, will try on bigger one
19:03cemericktechnomancy: you're approaching performance art here :-)
19:05ssideriscemerick: what are you referring to?
19:06cemerickssideris: technomancy's clojurebot ministrations
19:06ssiderishaha
19:06kencauseyclojurebot: asking
19:06clojurebotasking is Don't Ask to Ask, Just ASK
19:46sproustI'm having problems with (ns) and evaluation from Emacs.
19:47sproustIt seems very often when I'm adding a new use or require line, and then re-eval, some symbols collide and I get an error message.
19:47sproustI know that you can avoid some of them by explicitly excluding some symbols, e.g. , (:use [clojure.contrib [io :exclude [spit]]])
19:47sproust:exclude
19:47sproust... but is there a more general way to circumvent this problem?
19:47sproustI end up killing my VM and restarting everything in order to add my import, it's quite annoying. Any help appreciated.
19:48bortrebin order to be sure you don't get collisions you need to explicitly state everything you need using (:use [clojure.contrib [io :only [everything you need]]])
19:49bortrebwhenever I screw this up at the repl I use a macro I wrote called undef :
19:49sproustbortreb: if I *always* do that-- and I'll start trying this now-- can I always avoid collisions?
19:49bortreb(defmacro undef "removes symbol from the current namespace" [symbol] `(ns-unmap *ns* (quote ~symbol)))
19:49sproustbortreb: can you share? THx.
19:49sproustthx
19:50bortrebyes except you would theoritecually have to do this with clojure.core as well
19:50bortrebalso,
19:50sproustDoes Clojure have a startup file that always gets executed per-user, something like Python's sitecustomize.py?
19:50bortrebI don't believe so
19:51sproustSo you just require a library your own then?
19:51sproust(I meant use)
19:51bortrebwhenever I really screw up and use a lot of things accidently I have ns-clear :
19:52bortreb(defmacro ns-clear "unmaps all symbols from the current namespace (except in-ns and ns)" ([ns-name] `(ns-clear-fn (quote ~ns-name))) ([] `(ns-clear-fn (quote ~(symbol (str *ns*))))))
19:52lancepantzgood lord, this simple things should be simple stuff is still going?
19:52bortrebthat normally gets me back on track without restarting
19:52RaynesI think there is actually.
19:53bortrebyeah we could have just made clojure work great with nailgun/commandline with all the time that's been spent on that thread :)
19:53RaynesAccording to this: http://clojure.org/getting_started "he file user.clj, if found in the classpath, will be auto-loaded as well. You can leverage this to cause code to run when Clojure starts."
19:53Raynesbortreb, sproust: ^
19:54RaynesAssuming that's relevant.
19:54bortreb:sproust yeah -- it's jusst like java in that regard. For just hacking around I have a single namespace that just goes through and loads everything I want
19:54bortrebthanks Raynes
19:56sproustlancepantz: My guess is that this simple-things debate will never abate, as long as people unfamiliar with Java enter the Clojure world. Clojure looks from the outside as a promise to deliver something like Ruby/Perl/Python but then a newcomer hits all the Java snags. People have been blessed with the ease of dynamic language ubiquity now, if a new language isn't as "simple" and easy to get started with, I'm sure a lot of people will comp
19:56sproustlain (or go away). Just a guess.
19:56sproustAwesome.
19:57lancepantzbrenton summed up my opinion. you have to chose the right tools for the job
19:57sproustns-clear will be useful.... it takes >10secs to start a JVM on my Macbook.
19:57lancepantzi don't get why that guy keeps arguing, appears to me he's just trolling
19:57RaynesIt's the number of times he has repeated himself that gets to me.
19:57Raynes:\
19:58lancepantzyeah
20:02ninjuddbortreb: how do you implement ns-clear-fn?
20:02bortreboh, you obviously need ns-clear-fn
20:03sproustyeah i was just about to ask
20:03bortreb(defn ns-clear-fn "unmaps all symbols from the current namespace (except in-ns and ns)" ([ns-name] (map (fn [s] (ns-unmap ns-name s))(keys (ns-interns ns-name)))))
20:03bortrebsorry bout that
20:03sprousttak
20:04RaynesThat anonymous function could be shortened to #(ns-unmap ns-name %)
20:04sproustIs there any way to get better stack traces? I get nearly no information from Clojure errors, going half-blind.
20:04ninjuddbortreb: does that break other namespaces that already refer to those functions?
20:04sproustAny tricks?
20:05Raynes$google clj-stacktrace
20:05sexpbotFirst out of 205 results is: mmcgrana's clj-stacktrace at master - GitHub
20:05sexpbothttp://github.com/mmcgrana/clj-stacktrace
20:05sproustRaynes: would be nice to have a function run through your code and make those suggestions ;-)
20:05ninjuddbortreb: i.e. they will be referring to the old function definition
20:05Raynessproust: Indeed. We need a Clojure lint. I remember someone telling me that someone was working on one.
20:05sproustAwesome.
20:06bortreb:ninjudd like if some other ns did a use?
20:07ninjuddbortreb: right
20:14ninjuddbortreb: i'm not certain. we were just trying to do something similar in cake and that was the problem we ran into.
20:17bortrebI just tried this and it does seem that if you use a namespace and then clear that namespace, you'll still refer to the old function from that namespace
20:17bortrebbut isn't that the point of namespacing?
20:18ninjuddperhaps. though it can lead to unexpected behavior when you are editing a file
20:18bortrebif you namespace-qualify the function it is no longer accessale
20:19bortrebwhat sort of problems does that do to you while editing?
20:19ninjuddwell. in the case of cake, when you edit a file we reload it in the jvm without restarting
20:20ninjuddwe wanted to blow away the old namespace and reload, but that causes the use problem
20:20ninjuddso we have to just call load-file, which means that if you removed a function, it will still exist until you restart
20:21bortrebright
20:21ninjuddi thought perhaps you had solved the use problem ;-)
20:22bortrebwell it's similar to how updating a function at the repl using C-c C-c doesn't update it either in namespaces which invoke a naked use
20:23bortrebI guess you'd have to reload every namespace which uses it as well
20:23bortrebto be correct
20:23sproustIs there a way to tell Leiningen to always fetch the bleeding-edge/latest version of your lib?
20:23bortrebuse SNAPSHOT
20:24bortreb.... and then there's maven junk I don't understand
20:25sproustbortreb: thx.
20:26sproust"SNAPSHOT" is not always available it seems. I guess the project has to define it.
20:27lancepantzC-c C-c is what, compile form under point?
20:28ninjuddbortreb: right
20:29ninjuddsproust: i beleive you can use LATEST in maven, leiningen or cake
20:30ninjuddsproust: there is also RELEASE which is the latest non-snapshot version
20:32sproustninjud: thx!
20:37bortrebwhy is apply-macro so broken in contrib?
20:37bortrebcause it's easy to fix....
20:37bortrebis it a joke? like, don't ever use this because it doesn't work anyway?
20:39sproustI really, really don't understand that whole collision problem with (ns .. ). (ns-clear) doesn't seem to reset it either. (spit) is a big collider.
20:41sproustOnce my VM is jinxed it seems impossible to get back to a normal state, and I have to restart my VM.
20:54bortrebsproust: you're using a naked use on clojure.contrib.duck-streams, yes?
20:55bortrebI'm curious as to how you
20:55bortrebhave managed to screw up a namespace so bad that you have to restart
20:56bortrebbecause there are only two maps that hold all the symbol mappings for a namespace and if you clear those you should be back to square one
20:56bortrebI'd like to reproduce your sadness out of curoiusity
20:58sproustbortreb: I end up evaluating so much stuff that at some point it's all unclear what steps were taken. Then I restart with the outlook of "Okay, minimal evals on imports, so you can figure out what's going on" and then it works for a while, so I get back to coding, and then *ouch* I need an import, and all hell breaks loose.
20:58sproustNow, however, you're staying something VERY interesting:
20:59sprousttwo maps.... which/where/what is this jewel of information I should know about?
20:59sproustBTW I've got it kind-of working now: I do an undef on "some" symbols, and it seems to reset those maps enough that it works.
21:01sprousts/staying/saying/
21:02sproustIn Elisp I use (find-library) to load a module's source code. I've coded something similar for Python (find-module). Is there an equivalent for Clojure, e.g. I invoke an Emacs function, type the module name, and it figures out where it comes from to open it, using the live REPL's classpath?
21:02sproust(I guess I could just use filecache too.)
21:16sproustThe cheat-sheet is missing repl-utils/show (would have been useful just now).
21:19bortrebyou want who-calls
21:19bortrebC-c C-w C-c
21:19bortrebtry it out ;)
21:19bortrebit's even better
21:20bortrebalthough if yo ujust waht what you said do C-x 4 .
21:20bortreb(the . IS part of the command)
21:21sproustAaaaaaah even nicer. Slime rules.
21:22sproustThx
21:25sproustAaaaa it's sooooooo nice when it all works.
21:30sproustWouldn't it be nice if there was a syntax for an apply equivalent? e.g. something like this: (apply fun args) -> (fun & args), it would be useful for mixed cases, e.g. (apply fun (conj arglist arg1)) -> (fun arg1 & arglist)
21:30sproustPython does this with *, e.g. fun(*args), and even mixed: fun(arg1, *arglist)
21:31hartohi all - is there a builtin fn like filter but which returns two seqs - those matching pred, and those not matching pred?
21:34sproustThat's called "partition" in some other contexts, but in Clojure (partition) does something different:
21:34sproust,(doc partition)
21:34clojurebot"([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."
21:35hartoyeah - I tried looking for variants of split too, but no luck
21:36sproustAnother common use case that is similar is taking both (take n ...) (drop n ...); that's (split-at):
21:36lancepantzharto: you want group-by
21:36sproust,(doc split-at)
21:36clojurebot"([n coll]); Returns a vector of [(take n coll) (drop n coll)]"
21:36lancepantz,(doc group-by)
21:36clojurebot"([f coll]); Returns a map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the corresponding elements, in the order they appeared in coll."
21:37lancepantz,(group-by odd? [0 1 2 3 4 5])
21:37clojurebot{false [0 2 4], true [1 3 5]}
21:37hartoah yes! that looks about right :)
21:38hartothanks lancepantz
21:38lancepantznp
21:40sproustIt's a bit overkill no?
21:40sproust,(defn filter2 [pred coll] (list (filter pred coll) (filter (complement pred) coll)))
21:40clojurebotDENIED
21:42ninjuddsproust: there is (separate f coll) in contrib seq-util
21:43ninjuddbut group-by is more general and it doesn't require contrib
21:43sproustLovely... thx.
23:01sproustWhat is Clojure's equivalent of a simple zip functoin? e.g. (zip seqx seqy) yields (x1 y1) (x2 y2) ... ?
23:01tomoj(partial map vector)
23:01sproust(zipmap creates a map; I need the elements in order. I saw zip.clj for trees, not what i'm lookign for)
23:01tomoj,(map vector [1 2 3] [4 5 6])
23:01clojurebot([1 4] [2 5] [3 6])
23:01tomojlike that?
23:02sprousttomoj: Yes... what an unusal way to think about it.... Isn't that insanely expensive for such a simple operation?
23:02tomojI can't think of a cheaper way to do it
23:03tomojyou have to iterate over the seqs and you have to make vectors...
23:03sproustmaking cons cells instead?
23:03tomojwe don't have that kind of cons cell
23:03ihodeswe don't really have cons cells in clojure
23:03sproust,(map cons (range 10) (range 10))
23:03clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
23:03ihodesyou could map list instead.
23:03ihodesbut that doesn't change much
23:03sproust,(map list (range 10) (range 10)
23:03clojurebotEOF while reading
23:03sproust,(map list (range 10) (range 10))
23:03clojurebot((0 0) (1 1) (2 2) (3 3) (4 4) (5 5) (6 6) (7 7) (8 8) (9 9))
23:04sproustRight.
23:04sproustWhat would be cheaper than a vector or list in Clojure?
23:04ihodesnothing
23:04ihodes(oh god, i'm sure there's an exception now…)
23:05ihodeswhat are you doing that it needs to be cheap? are you working with prims? maybe you could use prim arrays (java nasty, there) for more speed, less memory
23:05ihodesbut i'm not sure it's actually be much faster…you'd have to test with time
23:06ihodes,(time (map list (range 10) (range 10)))
23:06clojurebot((0 0) (1 1) (2 2) (3 3) (4 4) (5 5) (6 6) (7 7) (8 8) (9 9))
23:06clojurebot"Elapsed time: 0.126 msecs"
23:06ihodes,(time (map vector (range 10) (range 10)))
23:06clojurebot([0 0] [1 1] [2 2] [3 3] [4 4] [5 5] [6 6] [7 7] [8 8] [9 9])
23:06clojurebot"Elapsed time: 0.125 msecs"
23:06tomojthat's misleading
23:07tomojthe printing happens after the time is up
23:08ihodesyeah needs a wrap with doall, right?
23:08tomojcoincidentally I think it might have been you, ihodes, I wanted to remind about this problem
23:08tomojwere you the one that made the fibo function that was way faster than the prim example?
23:08emhI'm having a problem using vimclojure with the latest clojure snapshot
23:08tomojif so, same problem
23:08ihodestomoj: hah! *THAT* was it. god that's so obvious. lazy-seqs bite sometimes
23:09tomojyours probably still was way faster
23:09ihodesbut definitely a difference
23:09tomojbut the times I saw in here were before printing
23:09ihodesi really need to remember laziness when using time.
23:09emhI get a java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer at line 5977 of Compiler.java
23:09ihodestomoj: thanks for pointing that out
23:09emhin eval function, seems like it's a line number that's a long and it's casting it to integer
23:10emhdunno if it's vimclojure's fault or something wrong in clojure
23:11emhI sent a report to vimclojure author anyhow
23:11tomoj,(time (dorun (map list (range 10000000) (range 1000000))))
23:11clojurebot"Elapsed time: 2657.312 msecs"
23:11tomoj,(time (dorun (map vector (range 10000000) (range 1000000))))
23:11clojurebot"Elapsed time: 2392.547 msecs"
23:11tomojno significant difference
23:15KirinDaveGrumble.
23:15KirinDaveMan, I let my clojure install get out of date.
23:15KirinDaveAnd now all hell has broken loose.
23:16KirinDaveAnd on top of that, Oreilly uses docbook for books. DocBook!
23:16ihodeskirindave: congrats on that, btw :)
23:16KirinDaveihodes: Thanks. I'm looking forward to it.
23:17ihodesme too—this college student will have to give up some ramen for it :)
23:17KirinDaveAlthough I dunno how a nobody like me secured the gig. :)
23:17ihodesobviously it was all chas ;)
23:17KirinDaveProbably so!
23:17KirinDaveHe certainly is more diligent on contract negotiations than I could bring myself to be.
23:18ihodesby the way, you need to launch your damn bank so I can switch ;)
23:18KirinDaveYeah well!
23:18KirinDaveThat job starts monday
23:19KirinDaveSo gimme a day or three to make an entire financial institution with api.
23:19KirinDaveI bet there is a macro
23:19ihodesSo awesome. those guys seem so nice, and freaking smart.
23:19ihodesdo-bank
23:19ihodesyeah it's in clojure.finance
23:19KirinDave(with-friendly-banking-system ...)
23:20KirinDaveI'm excited to use clojure in a professional setting.
23:20KirinDaveI just have to be careful not to overplay my hand.
23:20ihodeshaha don't you wish :) do we get to hear what technologies you'll be using (or some of them) that was the thing I begged Josh for last year
23:20KirinDaveGotta make sure our scala lovers get some victories. :)
23:20KirinDaveI'll let you know when I know.
23:20KirinDaveWe'll definitely be using clojure. Probably for the basis for the API servers.
23:21KirinDaveMakes sense, Clojure is king of state propagation.
23:21ihodesthat's so great. i'm the most excited i've been about banks since i got a debit card.
23:21KirinDaveMe too.
23:21ihodesand that debit card was a big deal.
23:22KirinDaveJust imagine: a card that can hit your checking, savings, other bank accts, and other credit cards.
23:22KirinDaveLike a SUPER debit card, so you can get SUPER excited.
23:22sproustWhich bank is this? Is this related to Bank SImple?
23:22ihodesit *is* bank Simple
23:23ihodesKirinDave is taking over
23:23emhyay, I fixed it. to anyone wanting to use vimclojure on latest clojure snapshot, you need to replace "line" with "(Integer. (.intValue line))" on line 129 of vimclojure/repl.clj
23:24KirinDaveihodes: I should release katamari this weekend before the craziness with the book and bs starts, huh? :\
23:24KirinDaveNo rest at all.
23:24ihodesnot for the wicked. not for the Lisper.
23:25KirinDaveOr the Erlanger.
23:25KirinDaveSo I guess even less rest for the polyglot?
23:25ihodesno way. they get the rack.
23:25sproustBankSimple's idea rocks. I've been thinking about it ever since a foo sent me a link to it.
23:26ihodesby the way, are any of you looking at/participating in the Google AI contest?
23:28KirinDaveihodes: Who me?
23:28KirinDaveNot that I know of.
23:29ihodesKirinsDave: or anyone in the IRC. i cobbled together a Clojure starter pack, so I'm hoping they allow Clojure as a participating language. it looks fun–Galcon, but with bots. so badass.
23:32tomojihodes: "oh, don't worry that I slapped a license on your code, this is a good license" I lol'd
23:33ihodestomoj: i'm glad haha, i know so little about licenses or anything like that I wasn't sure if I was just being an ass. it felt a little off, though… 
23:34lancepantzihodes: i saw your starter pack cool stuff
23:35lancepantzhadn't played galcon before, its a great game
23:35ihodeslancepantx: now make a sweet bot with it. i've just begun figuring out my heuristics… there's so much to calculate.
23:36ihodeslancepantz: such a great game! I've been playing it on and off for a year, whenever i have enough battery left on my iphone…i'm going to base my bot around how i play/my through process.
23:36ihodesthought process, that is
23:36lancepantzit would be awesome if a clojure bot won it
23:36lancepantzit's always the c++ versions in the top 10 of these things though
23:37ihodesjust because last time it was a simple min-max deal, basically. so C++ was just a question of making it fast, and they have a lot of experience with that
23:37lancepantzwas that the lightcycle one?
23:37ihodesyeah.
23:42ihodesmy fingers are so used to typing (in-ns 'stimfinder.core) (the core of my summer's job/program/internship) that I still do it now…frustrating. it's like trying to do emacs shortcuts in IE.
23:56defnI have a structure: (("1" "abc") ("2" "abdef")), I also have a structure (3 5 ...) which is the number of characters in "abc" and "abdef"
23:56defnid like to make a new structure that sorts them by the length of the string
23:58defnsilly question -- sort-by makes that easy, i guess i was just trying to unify the number of occurrences, AND the length of the string, and the string itself into some sort of malleable structure