#clojure logs

2010-06-06

00:39technomancy,(apply (fn [& args] (meta args)) (with-meta [1 2 3] {:hello :world})) ; <= there's no way to make this work, is there?
00:39clojurebotnil
00:39technomancymetadata doesn't seem to survive apply/varargs restructuring
00:39technomancyyou'd have to be a little bit crazy to expect that it would, I suppose
00:42Chousukemaybe with :as somehow?
02:03defntechnomancy: like what?
02:03defnAlso, does anyone know when 1.2 is expected to be released?
02:23replacadefn: when it's ready... Rich hasn't committed to a date, but he's trying to get a first beta out in the next few weeks, I think. Then he'll see how stable it seems for folks before going to RC and then Release
02:24replacait feels to me like we're on track to release late July or August, but that's completely my read of what's going on and not an official position at all
02:25defnreplaca: ya, im not anxious about it per se, to be honest there's a lot of stuff in there that I still have yet to use :X
02:26defnreplaca: at the same time I'm finding it rather annoying that a large swath of libraries have not been refactored for 1.2.0, or do not have 1.2.0 releases
02:26replaca,(apply (fn [& args] (meta args)) (with-meta [1 2 3] {:hello :world})) ; <= there's no way to make this work, is there?
02:26clojurebotnil
02:26defnhalf of them have...have of them haven't
02:27defnreplaca: ermm, im not sure what you want to do...
02:27defnwhat do you expect it to returbn
02:27defnreturn*
02:27replacai'm playing with what technomancy was doing before
02:27replaca,(apply (fn [& args] (meta first args)) (with-meta [1 2 3] {:hello :world})) ; <= there's no way to make this work, is there?
02:27clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$meta
02:27replacaarg, no paredit in irc
02:27defn:)
02:28replaca,(apply (fn [& args] (meta (first args))) (with-meta [1 2 3] {:hello :world})) ; <= there's no way to make this work, is there?
02:28clojurebotnil
02:28replacaoh, I see what he was thinking now
02:28replacathat's crazy!
02:28defnplease explain
02:29replacatechnomancy posted the original thing to try to make metadata pass through apply, but I was confused about what he meant
02:29defnand i stil am :)
02:29replacabut he meant adding metadata to the *whole* arg vector
02:30replacaand grabbing it in the func that was applied
02:30replacabut that can't happen
02:30defncould you illustrate a real world example?
02:30replacano, cause it was his thing
02:30replacai was just trying to figure out what he was trying to accomplish
02:31replacabut *why* you'd want to do that is another thing altogether :-)
02:31defnlol okay just trying to imagine but yeah, i got nothin
02:32replacadefn: I know what you mean about being in a no man's land between 1.1 and 1.2. I'm suffereng from that too
02:36quizmehow do you make an event loop?
02:36quizmelike to make a real time system
02:36quizmewithout eating up all the CPU
02:37defnreplaca: yeah, isn't it a bummer? I like to just peruse disclojure, grab some random new library, plug it into an existing project, try it, play with it, maybe keep it, maybe not -- but half the time my project is 1.1 and the lib is 1.2 or vice versa
02:38defnin most cases it's just a matter of changing a bunch of clojure.contrib names, it might not work all the time, but i bet it'd work at least 40% of the time
02:39replacathis release is a much bigger thing than we've tackled before with a much higher standard of correctness
02:39replacaso it's taking longer to bake
02:39defnit's awfully hard to be angry about that
02:39defni really would like to contribute to clojure, but my clj-fu is so weak compared to the geniuses working on it
02:39replacain particular, there's a *lot* more community discussion and involvement
02:40defni feel like id just get in the way or make more work for other people
02:40replaca1.1 was just rich with help from chouser
02:41defnyeah, i guess i am just seeing all of the contrib stuff funnel through
02:41replacafor 1.2, stu holloway is organizing everything, but I'd bet that there are contributions at some level from between 25 and 30 people and major contributions from ~10 poeple
02:41defni gotta say i always love stuart H's views on clojure stuff
02:41defnnaming, etc.
02:41defnreally love his approach
02:42replacawell, that's part of it. but all of that is being sifted through very carefully to see what we want to live with
02:42replacayes, we're lucky to have people with very good taste around (probably attracted by the fact that Rich has such good taste)
02:43defnim sort of a "taste" guy myself -- there has to be some damn flavor or i'm bored
02:44replacaChouser and Stu leap quickly to mind, but it includes many others. For example I continue to be impressed by the group here in the bay area
02:44KirinDavereplaca: How did the meetup go?
02:45replacaKirinDave: well. it was a good group - always a little uneven because we welcome folks with vastly different levels of experience
02:45KirinDaveHuh.
02:46replacain the past, we had done almost totally presos but this time I tried to have a collaborative session
02:46KirinDaveHum
02:46KirinDavereplaca: When is the next one?
02:46KirinDaveI will try and make time to come.
02:46replacawell, some folks have done a ton of Clojure and some folks are just interested
02:46KirinDaveThat's sort of the lisp divide, I guess.
02:46replacathey're about every month - 1 mo in SF, the next in Mt. View
02:47replacaso the next one in SF should be in august
02:47replacaAmit Rathore figures out the dates
02:47KirinDavereplaca: Have you thought of splitting to a hackfest and a preso?
02:47replacaI was just thinking about that today actually
02:48replacawhat occured to me was lead off with a preso on something interesting to all then split into to groups, one hacking, one covering an introductory topic
02:48replaca*to => two
02:48tomojhopefully I will be in SF in a year or so /me hopes vigorously
02:49replacatomoj: where are you now?
02:49tomojaustin
02:49defnreplaca: where was the meetup?
02:49replacathere are worse places :-)
02:49tomojcertainly
02:49tomoj3 people here interested at meetup.com
02:49defni started a meetup group in Madison, WI -- already have a few people
02:49KirinDavereplaca: You know what would be pretty amazing as a way to do a hackfest?
02:49replacaat Weatherbill in SoMa
02:49replacaKirinDave: shoot
02:49KirinDavereplaca: Oh man, this'd be a hackfest just to make an awesome tool for a collab hackfest.
02:49KirinDavereplaca: Have a remote jvm that opens up repls on demand.
02:50KirinDavereplaca: And then a visualization that can run locally on your machine showing what's changing in that vm
02:50KirinDaveAnd everyone could build a short term project onto the vm in situ.
02:50replacaKirinDave: that's pretty serious for a hackfest :-)
02:50defni want a collaborative real time hacking tool -- a remote pairing tool
02:50tomojscreen? :P
02:50KirinDavereplaca: It might take a few meetings to get the actual tool done
02:50defntomoj: more features please
02:50KirinDavereplaca: But you have to admit that'd be a cool thing.
02:51replacadefn: the sonian guys live in screen/emacs and they've been doing similar stuff at Seajure
02:51replacaKirinDave: indeed I do
02:51defntomoj: built in video conferencing, no need to use the same editor, users can choose whether they want vim or emacs bindings, etc.
02:51tomojhmm
02:51tomojhave to virtualize the files I guess?
02:52tomojor use something like obby maybe which can be supported by different editors
02:52replacadefn: that's tough, cause if you want emacs, you don't want just the bindings
02:52defnreplaca: yeah i know, it's sort of a weird idea i guess, i just always picture github, but with a more direct community involvement in code
02:52tomojpresumably this thing is not an editor, but something you hook your editor to
02:53defninstead of checking out, submitting the pull request and such, you edit the project there, online, in real time, with other people
02:53defntake some of the barriers to contribution away, make it more social
02:53replacatomoj, defn: yeah, that would be cool. I've never seen anything like it
02:54tomojI guess it's kinda like wave but focused on code?
02:54defnive seen collaborative editing tools, but not one that leveraged git and sort of built it into the whole distributed project thingamajig
02:54defntomoj: yeah, only i see needing some backend hooks for git
02:55replacait doesn't seem too hard in principle, but in practice there are a ton of details to get it to work with legacy editor
02:55replaca(and despite what technomancy thinks, emacs is a legacy editor :-))
02:55defn:D
02:56replacaI think I might have been using it before he was born, but I know legacy when I see it :-)
02:56defnactually i sort of fell into clojure because i wanted to learn emacs, and then i wanted to learn lisp as a result, and then i wanted a lisp which i could actually /use/, and here we are
02:56defnanyways, back to the idea, if you dont mind chatting about it im trying to flesh a couple details out
02:56replacaKirinDave: I saw you tweet that you were having some success using wave for collaboration. What sort of stuff are you doing with it?
02:57replacadefn: np
02:57hiredmanscreen works very well
02:57replacahiredman: I've been doing the conversion to tmux
02:57KirinDavedefn: Common lisp is pretty usable.
02:58hiredmansome of the guys are using tmux
02:58hiredmanI've been using screen for a long time
02:58hiredmantmux has some different behaviour for sharing screens
02:59hiredmanwith screen the window you are looking at is independent, with tmux so far it seems like you get yanked around and everyone in a session always sees the same window
02:59hiredmanI've seen some weird kind of hangs here and there, dunno what causes them
02:59hiredmantmux may be nicer for single purpose use, but I think screen is nicer for multiuser stuff
03:00hiredman(but easier to just use one for both)
03:01defnI imagine this being the story: User A goes to website (think github in its current incarnation). User A goes to project such-and-such. User B is already on project such-and-such doing some hacking. User A "snoops" in on User B actively editing files. User A watches for awhile, sees User B write some ugly function. User A rewrites the function while User B moves on to other matters. User A and B are not the project owner so they automatically are ...
03:01defn... forced into working on a branch which is magically created for each editing session. When a session is ended by all participants explicitly clicking "end session", the session is ended. Or, when all users leave the session (timeout, etc.), the session is ended. Project Owner can then browse these branches in their browser and merge changes.
03:01tomojdefn: seen this? http://github.com/technomancy/conspire
03:01defnYeah I have, conspire is very dated now. Rudel was the successor
03:02tomojoh, does rudel use git too?
03:02defnI've used Rudel but it is rather buggy and still forces using Emacs which I think presents a large barrier for collaborative editing. Users should be able to have a "good enough" editor in their browser to socially code. The editor in the browser could allow plugins to be written for it.
03:02replacahiredman: yeah, I mostly colloborate with myself with tmux (that is, I just use it so I can be attached from home, work and the various cafes in North Beach)
03:02tomojjust obby I guess
03:02defntomoj: yeah, no git
03:02tomojrudel shouldn't force emacs ideally
03:03defnagreed. I think that's the author's plan. I spoke to him awhile ago.
03:03tomoje.g. at http://www.emacswiki.org/emacs/Rudel you see emacs + gobby
03:03defnHe was planning on implementing it in all sorts of ways.
03:03defnmake it very editor agnostic, etc.
03:03tomojit already is, isn't it? just support obby and your editor is good to go, no?
03:04defntbqh I don't really know
03:05replacaok, time for me to go to bed. g'night all.
03:05defng'night replaca -- good talkin to you
03:05replacau too
04:21LicenserRaynes: to the defense of my defense, I didn't know the difference between cdr and second since I did not know what cdr is at all :P
04:25defnis cdr like rest?
04:25defnwhere second is (first (rest coll))
04:25defn$(rest [1 2 3 4])
04:25sexpbot=> (2 3 4)
04:26defn$(first (rest [1 2 3 4]))
04:26sexpbot=> 2
04:26defn$(cons [1] [2])
04:26sexpbot=> ([1] 2)
04:26defn$(cons 1 2)
04:26sexpbotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
04:27defn$(cons [1 2] [3 4])
04:27sexpbot=> ([1 2] 3 4)
04:27defn$(cons [1 2] 3)
04:27sexpbotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
04:27defn$(cons 0 [1 2])
04:27sexpbot=> (0 1 2)
04:27defn$(first (cons 0 [1 2]))
04:27sexpbot=> 0
04:27defn$(rest (cons 0 [1 2]))
04:27sexpbot=> (1 2)
04:28defn$(first (rest (cons 0 [1 2])))
04:28sexpbot=> 1
04:28defn$(second (cons 0 [1 2]))
04:28sexpbot=> 1
04:28defni think that's right...right?
04:28defnoh god -- didn't know I was in #clojure, thought I was in #clojure-casual, sorry for the spam all
04:29tomojI don't think you can easily compare cdr to something in clojure
04:30tomoj(cdr '(1 2 3)) is '(2 3), so sorta like rest
04:30tomojbut (cdr (cons 1 2)) is 2, which doesn't make any sense in clojure
04:31tomojon lists, anyway, it's like rest
04:42defndoes cons behave differently in clojure?
04:43defnin lisp could you (cons 1 '(1 2 3))
04:44tomojyeah
04:45tomojbut cons in lisp returns a tuple, really
04:45tomojand a list is just a tuple where the second element is another list
04:45defnwait wait... so in '(1 2 3), 2 is a list?
04:45tomojnot really much different from first/rest I guess, but you can stick anything in the second element in CL
04:47tomojno, '(1 2 3) is an abbreviation for '(1 . (2 . (3 . nil)))
04:47tomoji.e. (cons 1 (cons 2 (cons 3 nil)))
04:47defnohhhh! ah-ha
04:47defnis that what happens in clojure also?
04:47defnor is the sequence abstraction what makes the diff.?
04:47tomojit's pretty similar to clojure's first/rest, I guess
04:47tomojbut (cons 1 2) won't work
04:48tomojin lisp you can build whatever kinds of crazy things you want out of cons cells
04:48tomojin clojure we have nice abstractions :)
04:48defnyeah ive seen crazy mixtures of cons and such in lisp
04:48defnalways scared the **** out of me
04:48gregheverything is a tree!
04:48defnis this IRC channel a tree?
04:49greghyes. mutable, too.
04:49defni can't change this statement.
04:55tomojthe channel is an identity, not a value
05:52defnim not clear on identity still...
06:17tomojvery difficult to get clear on identity outside programming languages :)
06:17tomoj(er, outside programming languages and other formal or nearly formal contexts..)
06:36defntomoj: could you try to give me some idea
06:37defni've watched rich, and im 100% on state and time, but identity has me a bit confused, or...well...maybe not
06:37esji like the idea of people as identity
06:37BorkdudeWhat would be the most idiomatic way to keep a number in a function that remembers the amount of time it has been called?
06:37defn"no man can cross the same river twice"
06:37esj"Rich" is an identity
06:37defnBorkdude: don't do that!
06:38defnBorkdude: metadata
06:38defnBorkdude: sorry I thought you were saying you were going to keep track of "time" in your function
06:39Borkdudelet me put it another way. I want to construct a finite lazy-seq of elements with a fn that knows when to stop
06:40BorkdudeHow would I do that?
06:41defnlike based on a predicate or something?
06:41defnim not sure i follow
06:42defn,(class (lazy-seq (into [] (repeatedly (fn [] (rand-int 10))))))
06:42clojurebotclojure.lang.LazySeq
06:43defn,(lazy-seq (into [] (repeatedly (fn [] (rand-int 10)))))
06:43clojurebotExecution Timed Out
06:43defnerr duh
06:43defn,(lazy-seq (into [] (repeatedly 10 (fn [] (rand-int 10)))))
06:43clojurebot(6 1 0 6 2 9 5 6 2 9)
06:43defn,(class (lazy-seq (into [] (repeatedly 10 (fn [] (rand-int 10))))))
06:43clojurebotclojure.lang.LazySeq
06:43Borkdudehmm, let me go back one step more
06:44BorkdudeI want to construct an example of a lazy-seq with the last element causing a side effect, like printing "boom!"
06:44Borkdudeand the difference with and without doall
06:46defnohhhhhhh
06:46defnoh man -- i remember a discussion about this...
06:48Borkdudemaybe I can just do (lazy-cat (repeat 100 :foo) (fn [] (print "boom!")))
06:51Borkdude(let [l (lazy-cat (repeat 100 :foo) (print
06:51Borkdude "boom!"))] (take 10 l))
06:53defnlazy-cat is deprecated
06:54defnerr sorry i was thinking lazy-cons
06:54defn,(lazy-cat (repeat 10 :foo) (fn [] (print "boom!")))
06:54clojurebotDon't know how to create ISeq from: sandbox$eval__8883$fn__8886$fn__8887
06:55defn,(lazy-cat (repeat 10 :foo) [(fn [] (print "boom!"))])
06:55clojurebot(:foo :foo :foo :foo :foo :foo :foo :foo :foo :foo #<sandbox$eval__8891$fn__8894$fn__8895 sandbox$eval__8891$fn__8894$fn__8895@145974f>)
06:55tomojdefn: have you read http://clojure.org/state ?
06:55defn,(lazy-cat (repeat 10 :foo) ["boom!"])
06:55clojurebot(:foo :foo :foo :foo :foo :foo :foo :foo :foo :foo "boom!")
06:55defntomoj: I have yeah
06:56tomojwell, "a stable logical entity associated with a series of different values over time"
06:56defnI think I understand the whole thing but haven't externalized it
06:56tomojah, yeah
06:57tomoj,((fn countdown [n] (lazy-seq (if (pos? n) (cons n (countdown (dec n))) (println "BOOM!")))) 10)
06:57clojurebot(10 9 8 7 6 5 4 3 2 1)
06:57tomojwhere's the boom? :(
06:58defncan't println it i dont think
06:58tomoj$((fn countdown [n] (lazy-seq (if (pos? n) (cons n (countdown (dec n))) (println "BOOM!")))) 10)
06:58sexpbot=> BOOM! (10 9 8 7 6 5 4 3 2 1)
06:58defnoh, there ya go
06:58defnnice
06:58tomoj$(take 5 ((fn countdown [n] (lazy-seq (if (pos? n) (cons n (countdown (dec n))) (println "BOOM!")))) 10))
06:58sexpbot=> (10 9 8 7 6)
07:00defn,(let [[a b] (repeat 10 :foo) #(println "boom!")] [a b])
07:00clojurebotjava.lang.IllegalArgumentException: let requires an even number of forms in binding vector
07:00defnerr
07:00BorkdudeIs there an iterate that takes n?
07:00defn,(let [[a b] [(repeat 10 :foo) #(println "boom!")]] [a b])
07:00clojurebot[(:foo :foo :foo :foo :foo :foo :foo :foo :foo :foo) #<sandbox$eval__8913$fn__8914 sandbox$eval__8913$fn__8914@48a7d7>]
07:00Borkdudelike (iterate 100 inc 0)
07:00defn,(let [[a b] [(repeat 10 :foo) #(println "boom!")]] [a] b)
07:00clojurebot#<sandbox$eval__8919$fn__8920 sandbox$eval__8919$fn__8920@9f69e0>
07:03BorkdudeOr maybe there is something as a lazy while or loop?
07:04tomoj"iterate that takes n"?
07:04tomojI guess you don't mean this:
07:04tomoj,(take 5 (iterate inc 0))
07:04clojurebot(0 1 2 3 4)
07:05Borkdudetomoj, no I wanted to do: (lazy-cat (iterate 100 inc 0) (println "boom!"))
07:07tomojI don't think you're going to be able to do it without lazy-seq
07:07Borkdude(def l (lazy-cat (range 1 100) (print
07:07Borkdude "boom!")))
07:07tomojthe println returns nil and presumably you don't want that nil returned in the seq
07:07BorkdudeThat one works.
07:08tomojoh, heh, yeah
07:08tomoj,(lazy-cat [1 2 3] nil)
07:08clojurebot(1 2 3)
07:09BorkdudeSorry: (def l (lazy-cat (range 1 100) (do (print
07:09Borkdude "boom!") [100])))
07:09tomojI liked the previous one better
07:09Borkdude(last l) => "boom!"100
07:09tomoj,(last (lazy-cat (range 1 101) (println "boom!")))
07:09clojurebot100
07:09clojurebotboom!
07:09Borkdudeyeh ok
07:10defn$(let [l (lazy-cat (range 1 100) (do (print "boom") [100])))
07:10sexpbotjava.lang.Exception: Unmatched delimiter: )
07:10defn$(let [l (lazy-cat (range 1 100) (do (print "boom") [100]))))
07:10sexpbotjava.lang.Exception: Unmatched delimiter: )
07:10defngrrr
07:10Borkdudedefn, you're missing a ]
07:10defn$(let [l (lazy-cat (range 1 100) (do (print "boom") [100])]))
07:10sexpbotjava.lang.Exception: Unmatched delimiter: ]
07:11defnlol *sigh*
07:11defnit's late.
07:11tomojno need for do or adding an extra value on the end
07:11tomojas long as whatever does the booming returns nil, it's ignored
07:11BorkdudeAnd now I want it to not print anything, but only seeing the side effect printed
07:11tomojI mean, it won't affect the seq returned, anyway
07:12tomojhuh?
07:12Borkdudeso how do I do that with (lazy-cat (range 1 101) (println "boom!"))?
07:12defn$(let [l (lazy-cat (range 1 100) v (print "boom"))] l v)
07:12sexpbotjava.lang.Exception: Unable to resolve symbol: v in this context
07:12defnokay i quit, time for bed -- night all :)
07:12tomoj$(dorun (lazy-cat (range 10) (println "boom!")))
07:12sexpbot=> boom! nil
07:14Borkdudeah right, the difference between dorun and doall
07:14Borkdudeok I know enough now... tnx, gtg
07:14tomojdoall still only prints "boom!"
07:14tomojyou're just seeing the return value printed at the repl
07:15Borkdudeah right, return vals
07:15Borkdudebye!
08:23Licensercookies
09:39Licenserawsome: http://www.youtube.com/watch?v=b6YTQJVzwlI
09:46raekwow.
09:46Licenseryea my thought
09:47Licenserespecially since it's a live demo and not some lab preset movie thing
09:48defnHow do I get (11 32 45) from (10 11 30 32 41 45)?
09:48defnbasically i want every other item in a seq
09:48axiwith re-matches, how would I enable DOTALL on this regex "(?<=\\<p\\>).*?(?=\\</p\\>)"
09:49axiI read (?s). goes somewhere, but I can't get it to work..
09:50MayDanieldefn: (map second (partition 2 [10 11 30 32 41 45]))
09:50Licenseraxi: (?s) should work in the beginning
09:57rfg,(take-nth 2 (rest [10 11 30 32 41 45]))
09:57clojurebot(11 32 45)
09:57axiweird, (re-matches #"(?<=\\<p\\>).*?(?=\\</p\\>)" "<p>test</p>") returns nil
09:59Licenserdefn: actualy It hink this would be an excelent way to write a lazy seq funciton
10:02axithat regex works in java, actionscript, javascript etc.. so what's clojure expecting differently?
10:13Tweyaxi: I'm guessing Clojure uses POSIX regexes
10:18LicenserTwey: nope they use the java ones
10:19Licenseraxi: http://github.com/Licenser/clj-highlight/blob/master/src/clj_highlight/syntax/java.clj#L50
10:19TweyHuh.
10:19Licenserthere is how I use (?s:)
10:19TweyThen if it works in Java, it must work in Clojure too
10:20Licenserit does as you see in the link I posted I use (?s and it works fine :)
10:23Licenseraxi: your problem is another one
10:23Licenser\\ is the problem
10:23Licenserit was too obviouse to see right ahead ;)
10:24Licenser,(re-find #"(?<=<p>).*?(?=</p>)" "<p>test</p>")
10:24clojurebot"test"
10:24Licenserthere :)
10:28djpowellhmm - what is (let [] ...) all about?
10:29djpowellin the latest checkin
10:31Lajla,(let [x 3] 3)
10:31clojurebot3
10:32djpowellin rich's latest checkin he has replaced (do ...) with (let [] ...) in a few places - ie with empty bindings
10:32Lajla,(let [yo-momma 3 my-fatha 4] (+ yo-momma my-fatha))
10:32clojurebot7
10:33djpowellperhaps it has something to do with locals clearing
10:35Licenserdjpowell: I think let does not clear locals it keeps the outer ones
10:36Licenserperhaps it is a performance thingy
10:36Licenserperhaps let is faster then do?
11:23rhickeycemerick: ping
11:23cemerickrhickey: Morning. :-)
11:25rhickeycemerick: so, you balked at make-Foo ctor fn, due to namespace pollution. We have (record ::Foo ...) ready, but I'm having second thoughts
11:25cemerickrhickey: I'll do my best to talk you off the ledge.
11:26rhickeyhaving a universal multimethod like that is a modularity problem. But I wanted to hear your argument against (Foo-record ...)
11:26cemerickwhoo.
11:27rhickeyback when it was (Foo ...) no one seemed to have a problem
11:27cemerickwell, people were explicitly naming things Foo.
11:27rhickeytrue
11:28cemerickI mean, this is why (assoc record :slot 42) is a good idea -- you wouldn't want (Foo-set-slot record 42) and such junk.
11:29cemerickPeople shouldn't have to have a mental model of some poorly-defined var name templating going on in the language's innards.
11:29rhickeycemerick: I don't see a strong analogy there. Should it be (run :map (apply run :filter ...))
11:29rhickey?
11:31rhickeyWhy should there be a universal ctor fn?
11:31cemerick*if* we didn't have kw access for slots + an Associative impl, then you'd have to generate an accessor fn per slot.
11:32axiLicenser, a-ha. but why does it work for re-find but not re-matches?
11:32cemerickrhickey: I think Lau and AWizzArd were pushing for that hardest, to enable apply.
11:32cemerickbut...
11:32AWizzArdhmm
11:32Licenseraxi: it does too your problem is you added \\
11:32Licenserdon#t know why but it works
11:33cemerickrhickey: why is it a modularity problem? Wouldn't (record ::Foo ...) represent the same degree of polymorphism you get with assoc'ing on a record?
11:33AWizzArdWell, I think it would not hurt to have a universal ctor fn. My point however would be: I am not so much interested in a constructor, but more in a factory.
11:33axi(re-matches #"(?<=<p>).*?(?=</p>)" "<p>test</p>") returns nil
11:33rhickeycemerick: associng on a record is local, not global
11:33cemerickrhickey: isn't (record ::Foo ...) just creating a new Foo?
11:34cemerickand ::Foo is namespaced, no?
11:34cemerick(FWIW, if it's doable, I think (record Foo ...) would be preferable, but that's another topic.)
11:35rhickeycemerick: you are missing 'record' there, but ::Foo doesn't have a local notion of how to make one, record holds a global mapping
11:35chouseraxi: re-matches doesn't use a regex the same way as re-find
11:35chouser,(re-matches #"bar" "foobar")
11:35clojurebotnil
11:35rhickeythe meaning of (assoc foo ...) is with foo, not assoc
11:36axiic
11:36cemerickrhickey: From everyone else's perspective other than yours, the same applies to record IIUC.
11:36rhickeyI don't see how Foo implies (record ::Foo ...) any more or less than it implies (record-Foo ...). You have to know the rules
11:37AWizzArdbtw, could the universal constructor be made in such a way, that it accepts key/value pairs and initializes keys that were not mentioned with nil? For a (defrecord Foo [a b c]) one could then (record ::Foo :b 14, :a 3) ==> Foo{:a 3, :b 14, :c nil}
11:37cemerickAWizzArd: I think that'd just be an implicit into.
11:37cemerick(i.e. probably not going to happen)
11:37chouserwhy not a static method, (Foo/record ...) ?
11:38cemerickchouser: not easily apply-able
11:38AWizzArdchouser: yes, that would be nice, plus user-defined factories
11:38rhickeychouser: I like that for this, but it opens up static methods in general, and all they imply
11:39rhickeycemerick: I'm also thinking k v k v might be suboptimal if all people ever do is apply it, versus (Foo-record amap)
11:39cemerickrhickey: *nothing* in clojure works by defining vars like do-something-with-a-Foo. Everything does work by looking for the generic fn.
11:40Licenser(re-matches #"(?<=<p>).*?(?=</p>)" "<p>test</p>")
11:40Licenser,(re-matches #"(?<=<p>).*?(?=</p>)" "<p>test</p>")
11:40clojurebotnil
11:41Licenseraxi: good point I
11:41Licenserm
11:41Licensernot entirely sure
11:41rhickeycemerick: but these things really aren't true functions of names, as (record ::Foo ...) implies, forcing it into that shape makes record a universal map
11:41rhickey(Foo. ...) is a true function of the args
11:41LicenserI think it is a bug or a java thing axi
11:42rhickeybut we don't want to type-overload (Foo. ...)
11:42cemerickrhickey: again, that "universal map" is an impl detail that only you'd know about.
11:42rhickeyso this is a different function, of different args, needs different name
11:42cemerickrhickey: is this not a specific case of trying to make ctors apply-able?
11:43rhickeycemerick: no it's not, you want to insert ::Foo as an arg to a universal function where none need exist
11:43rhickeyjust to avoid naming a function
11:43rhickeya la (run ::map ...)
11:43cemerickrhickey: no, it's to avoid having vars named implicitly.
11:44cemerickI remember one of my biggest frustrations with CLOS was trying to figure out what slew of junk it spilled into my environment when I defined a class.
11:44rhickeycemerick: so (defrecord Foo [a b c] :ctor 'make-foo) is better?
11:45cemerickheh
11:45cemerickrhickey: if that came with the ability to define any number of factory fns, then yes
11:45cemerickit that :ctor val is just to get people to give a name to what you would otherwise implicitly define, then probably not :-)
11:46cemerickBack to the (perhaps general?) problem, I often see people wanting to do stuff like (apply com.foo.Bat. ....), so if a solution to that can be found, then this is irrelevant.
11:47rhickeythis is trying to provide an easy way to create a record given an existing map with some or all of its keys, getting away from the positionality of the ctor
11:47cemerickrhickey: shortsighted suggestion?: ensure all records have a no-arg ctor, and then (into (Foo.) my-map)
11:48rhickeyand providing a universal recipe rather than people making a bunch of variants themselves. could also be used for print/read
11:48cemerickhrm, I thought #Foo{:a 5 :b 6} was the target for reading?
11:48AWizzArdBut still, why is a constructor which just sets fields to some argument values so important, vs. a factory fn which will actually do some calculatios on the arguments and include some logic on how to init the fields?
11:49rhickeycemerick: the problems with (into (Foo.) ...) are: what to build it on, and how to make efficient
11:49rhickeycemerick: #Foo{...} is just an unreadable placeholder right now
11:49cemerickThe efficiency question is already out the window if you're getting away from positionality, no?
11:49cemerickright, I thought that was to become readable :-)
11:50rhickeycemerick: no, still a big difference between pulling the keys out once for a ctor call and a succession of assoces
11:50cemericksure
11:51rhickeyAWizzArd: because when you are correctly using records for information, there should be a way to create from data directly. Who will know about your special factory fns? No generic code
11:54rhickeywell, there are two things here. First is to move away from struct-map style k v k2 v2 style init
11:54rhickeysecond is what to call the factory
11:54AWizzArdlast time you came up with a nice definition of factory
11:55rhickeyAWizzArd: all I am saying is these are two separate issues. You can write your own factory fns whenever you want and call them anything you like
11:55AWizzArdif i remember correctly it was basically: constructors init all fields with the values of its paramater list, while factories can work on the given args and then construct an instance
11:55AWizzArdyes
11:56cemerickrhickey: why does record have to have a 'universal map' of factory fns? chouser's idea of having Foo/record (probably preferably Foo/_record or somesuch) seems good, where (record Foo ...) turns into (Foo/_record ...).
11:56cemerickrhickey: there's the interop case for being able to define factory fns, but that's another discussion.
11:56rhickeycemerick: you are talking about static Foo/record?
11:56cemerickyes
11:57rhickeyanswered above, my first preference, were it not to introduce the complexities of statics everywhere. Should it not, then very 'special'
11:57AWizzArdI just imagine that people will use factories in most cases, because there is some logic behind their objects. They want the factory to throw exceptions whatever. So, in the end I see most people ending up using the factories in their code, and so maybe not too much energy needs to go into the mere constructors. In principle Foo. would be enough. With that user-defined factories can be built.
11:58cemerickback in a sec
11:58rhickeyAWizzArd: I disagree, (make-Foo an-init-map) an important facility
11:59AWizzArdit sounds very useful
11:59AWizzArdto write my own factory fns
12:00rhickeycemerick: given (Foo/record ...) who needs (record Foo ...)?
12:03AWizzArdone minor objection regarding make-Foo is the uppercase "F" :)
12:03cemerickrhickey: Foo/record being the entry point doesn't address apply, is functionally the same as Foo-record, and takes up real estate you may want for honest-to-goodness interop stuff that would have to be static.
12:04cemerickAWizzArd: that's *exactly* the sort of backdoor naming templating junk people shouldn't have to think about :-)
12:04rhickeycemerick: that's not the question, if you had Foo/record would you need record Foo and why?
12:05rhickeyapplying static methods a separate general question
12:08cemerickrhickey: Big difference between need and prefer. Functional equivalence isn't sufficient, right? :-)
12:08cemerickWhat if someone wants to define a static factory fn called 'record'?
12:08cemerickNeeding to know about Foo/record is the same as needing to know about make-Foo
12:08rhickeycemerick: until they are added, static snot available for records
12:08rhickeystatics not
12:09cemerickright, but I'm keeping an eye out -- they seem pretty inevitable
12:09rhickeycemerick: everything you are saying points to :ctor my-ctor-name
12:10rhickeyi.e. dominated by name collision avoidance
12:11rhickeyor inversion, where everything becomes a function of a name
12:11chouserI can imagine general code that would have to use reflection to get at Foo/record, use str and resolve for record-Foo, and a simple function call for (record ::Foo ...)
12:12cemerickstupid wifi
12:12cemerickMy immediate thought to that is, why only one?
12:12rhickeycemerick: one what?
12:12cemerickctor
12:13rhickeycemerick: it has one definition, making a Foo from a map
12:13rhickeyelse we are into type-overloading
12:13chouserwe already have desire for at least two, right? (? 1 2 3) and (? :a 1 :b 2 :c 3), and/or (? {:a 1 :b 2 :c 3})
12:13rhickeynow, making it user-defined is another thing
12:13cemerickHonestly, I don't see why this is a different issue than assoc.
12:14rhickey(run :assoc m k v)
12:14cemerickrhickey: I didn't grok the argument from that shorthand before, either. :-)
12:14rhickeyassoc is leveraging the universal var map you are trying to prevent me using :)
12:15cemerickI am?
12:15cemerickI thought the universal map you were talking about was the set of all defrecord ctor fns, not the available namespaces, etc.
12:16rhickeythere is a function we are trying to name. It takes a map and returns a Foo. I want to call it Foo-something, you want to look it up in the record map using ::Foo as a key
12:16cemerickI have zero attachment to ::Foo
12:17rhickeyusing something as a key
12:17cemericksure
12:17cemerickI have a very, very strong attachment to using the names that I tell the language I want to use.
12:17rhickeyso, not directly naming the thing, as assoc is directly named, not looked up as some function of the word assoc
12:17cemerickah, I see the rub
12:18chousercemerick: what about ((factory Foo) :a 1 :b 2) ?
12:18cemerickIn this case, *no one* will think of this Foo-record as a separate fn.
12:18chouserI mean, how does that strike you?
12:18cemerickchouser: basically fine by me, but the HOF flavour will throw many for a loop.
12:18chouser(apply (factory Foo) :a 1 :b 2)
12:19chouserer
12:19chouser(apply (factory Foo) [:a 1 :b 2])
12:19AWizzArdhmm
12:19rhickeychouser: are you serious or is this just a straw man?
12:20chousernot sure. I'm not actually advocating it (yet), just exploring the space.
12:20rhickeychouser: it has the same problems as record Foo
12:21rhickeybut highlights the 2-step indirect nature
12:21chouserexcept in my two little examples there, factory could be a macro that expands to either record-Foo or Foo/record
12:22AWizzArdwhat about having a universal constructor fn "record" plus an optional create-foo, named by the user?
12:22chouserI guess I was wondering if the discomfort of generating extra vars was at all mitigated by having a standard mechanism for finding them based on the class name.
12:22rhickeyah
12:23rhickeywell, any such mechanism would have the modularity problem
12:23cemerickuser=> (ns-interns *ns*) ..... WTF is record-Foo?! :-)
12:23chouserI don't think I understand the modularity problem yet.
12:24rhickeycemerick: I don't see the huge surprise issues if defrecord is documented to define a set of vars, really
12:26AWizzArdi agree, it will be a well known common mechanism
12:26rhickeychouser: multimethods with universal registration will hold all classes forever. We can move away from that with pr* by going to protocols, but 'record' cannot be a protocol
12:27chouserahh
12:27chousermodularity of the multi-classloader variety
12:27rhickeycemerick: are you holding that no defblah should ever def more than one var, or be required to take the names for all such vars explicitly?
12:27cemerickrhickey: it's exposing implementation details, unnecessarily IMO.
12:27rhickeycemerick: what is?
12:29chouserif (factory Foo) just found (at compile-time?) the appropriate fn at a well-known place, I don't see the modularity problem.
12:30rhickeychouser: trust me, if (factory Foo) was built on make-Foo or Foo/create, and required compile-time resolution, few would use it outside of macros
12:31rhickeyit's not much more than the helper for str + resolve you mentioned before
12:35cemerickrhickey: I would cautiously assert that, yes.
12:35rhickeyand I would contend if defrecord was documented to create a factory from map call Foo-something, unless you overrode the name with :factory my-name, few would use the latter, even though it would save them from surprises and namespace injections
12:36cemerickI have no doubt that you are entirely right. Not sure that's an argument for Foo-something, though. :-)
12:36rhickeypresuming we came up with a good factory fn name
12:37rhickeycemerick: would such an override appease you? :factory-name my-name ?
12:37rhickeywould you use it?
12:37rhickeyI;m trying to tease out the two separate issues, namespace injection and data-driven calls
12:38cemerickrhickey: probably not, no. I'd just shake my head every time I typed Foo-something. :-/
12:39rhickeycemerick: even though Foo-maker was ready to go for HOFs, vs #(record Foo %)?
12:39rhickeyI would expect a lot of the latter with record Foo
12:41cemerickI'd perhaps hope for (app record Foo), but yes, I'd still shake my head.
12:42rhickeycemerick: and were we to work on apply-able ctors for Java stuff, would you want (constructor String)?
12:42cemerickha
12:42rhickeyer, (app constructor String)
12:43rhickeybecause that's what it seems you are asking for with records here
12:44AWizzArdrhickey: I would use that override key if it eliminates the uppercase letter from create-Foo
12:44rhickeyAWizzArd: then call your type foo
12:44rhickeyplease
12:46rhickeyanother option is to try to finesse the arities so there can be a single ctor set
12:47cemerickthat sounds unpleasant
12:47rhickeybut it seems finicky
12:48rhickeywell, I contend that defrecord will be producing at least 2 functions, and both deserve names. One is the type ctor itself, and that is taking the provided name. The other (factory from map) needs a name provided, or to generate one
12:49rhickeyrecord Foo is not a name
12:49cemerickuser=> (defrecord Foo [a b])
12:49cemerickuser.Foo/Foo-record
12:49cemerick:-P
12:50rhickeywho shares cemerick 's disdain for this?
12:50rhickeyheh
12:51cemerickIt's all rigged! Surveying on a sunday afternoon.... :-D
12:51rhickeyhah
12:51chouserIt makes me uncomfortable
12:52cemerickrhickey: defblah defining one and only one var is a pretty tough idiom to break for such a minor thing.
12:52chouserI don't have cemerick's experience with CLOS, and perhaps because of this my resolve isn't as hardened.
12:53chouserHonestly, Foo-record bothers me quite a bit less than record-Foo. Perhaps that just shows how shallow my understanding is of the issues at hand.
12:54cemerickThat's a long time ago, and wasn't for long. Similar experience with all the not-so-well-hidden junk in python objects.
12:54chouseroh, but I love hidden junk! Exposed junk perhaps less so.
12:55chouserI'd be happy to have a whole bevy of automatically-provided, high efficiency static factory methods in defrecord classes.
12:56chousermaybe each defrecord should create a namespace and put extra fns in there. :-)
12:56cemerickchouser: I almost suggested that. :-P
12:56cemerickeven crazier, of course
12:56chouseruser.Foo/record as a var instead of a statid method
12:57AWizzArdurgs
12:58cemerickI keep coming back to a no-arg ctor with a single-operation merge/into.
12:58rhickeyI'd thought a bit about that. I'm somewhat paranoid about the package/namespace/class trichotomy
12:58rhickeycemerick: that would be a pattern?
12:58chouserIt's not paranoia if it's true.
12:59chouseractually, I'm surprised it doesn't come up more often. I think things "just work" often enough that people can get a lot done without knowing exactly what's happening.
13:00rhickeyin any case user.Foo is already a class name
13:00rhickeyso a bad ns name
13:00cemerickrhickey: perhaps generally-useful. I have a record, I want its slots to be the same as the same-named slots in this map over here. Make it fast.
13:00chouserwe are seeing some questions about why (use 'foons) when foons has (defrecord Foo) isn't sufficient to say (Foo. ...)
13:00cemerick(merge-record (Foo.) {...}) (bad name)
13:01rhickeycemerick: I really hate uninitialized data like that
13:01NikelandjeloIs there a way to get values in let binding as vector?
13:01chouserit could be a transient. largely unusable until it gets some data and is persistent!.
13:02cemerickrhickey: that's just the relevant usage for this particular case. In other cases, it'd be (merge-record my-well-used-and-populated-Foo {...})
13:02rhickey(Fooify {...})
13:02cemerick:-D
13:02Chousukearrgh
13:03chouserNikelandjelo: not really. You could write a macro that takes a let-like vector of inits and provides those values as another vector.
13:04chouserNikelandjelo: (mylet foo [a 1 b 2] (prn foo)) ;=> [1 2]
13:05rhickeychouser: transients are different types than their persistents
13:06Nikelandjelochouser: Thanks
13:06rhickey(Foo-from amap) (into-Foo amap)
13:06chouserrhickey: yes, so the package would get "polluted" with classnames like __transient_Foo. Which is completely different than polluting a namespace with record-Foo
13:07rhickeychouser: but (Foo.) can't return anything but a Foo
13:07chouserOh. duh.
13:12cemerickrhickey: remember that defrecord names aren't usually as tidy as Foo, so you'd be looking at FormDefinition-from and into-FormDefinition, etc. (using one of our defrecord names in this case).
13:19rhickeycemerick: ok, still shorter than record FormDefinition
13:20cemerickha
13:21cemerickI wasn't really thinking about comparative length. Whatever reasonable thing you prepend or append to record names is likely to be dwarfed by the record name.
13:22rhickeycemerick: then people might use :factory ?
13:23cemerickso the factory fn will either be called FormDefinition-from, or whatever the author of the record decides otherwise. :-/
13:23AWizzArdbut please make it create-Foo, not make-Foo
13:29LauJensencemerick: Did you release the results of your poll ?
13:30cemerickLauJensen: tomorrow or Tuesday. I'm wrapped up with something for a little bit.
13:30LauJensenok, np
13:30cemerick(mostly trying to keep rhickey on the side of the light, actually ;-))
13:32rhickeyso, if there were factories for positional args, keyvals, and another map, what names would distinguish them? This is orthogonal to record Foo vs Foo-record
13:33rhickeyi.e. imagine you don't get Foo. positional ctor
13:34rhickeyrec, rec-map rec-from ?
13:35AWizzArd+1
13:36cemerickSeems like rec-from would delegate to rec-from pretty quickly?
13:37LauJensen?
13:37rhickeyto rec-map, yes
13:37cemerickright, sorry
13:38LauJensenI dont think the leaving out of 'ord' is a good thing, record-from isn't quite common lisp style verbose
13:42cemerickbbl (maybe :-))
15:07LauJensenChousuke: P pushes to origin - what if I want to push to another remote?
15:08Chousukehm, doesn't it let you choose? :/
15:08LauJensenno, it assumes - I think it asked me the very first time
15:09Chousukemaybe C-u P?
15:09LauJensenah yes ofc - thanks :)
15:18hsjunnessonQuick question, how do I instance a class pointed out by a var? Like I want to do something like (def s String) (new s)
15:18hsjunnesson"Unable to resolve classname: s"
15:19opqdonut(def s String) (.newInstance s)
15:19opqdonutor somesuch
15:19opqdonutsee the api doc for the Class class
15:20hsjunnessonAh yes of course.
15:20hsjunnessonThanks.
15:42bendlashey folks
15:42LauJensenHey
15:42bendlasquick question: can you tell me what happened to clojure.test/thrown? in 1.1 ?
15:46bendlasor is it yet to be added in 1.2?
16:44StartsWithKhow can i use clojure.core/import*?
16:45a_strange_guyYou shouldn't
16:45a_strange_guyit's an primitive internal special form
16:46StartsWithKi know
16:46StartsWithKbut i need to use it
16:47a_strange_guywhy?
16:47clojurebotwhy not?
16:47a_strange_guylawl ^^
16:48a_strange_guyStartsWithK: clojure.core/import* isn't a function
16:49a_strange_guyso you cannot use it to import classes dynamically
16:49StartsWithKhow is deftype doing it?
16:50a_strange_guydeftype is a macro
16:50StartsWithKi see, they are all macros
16:50StartsWithKhmm, inconvenient
16:51a_strange_guyi think there is a method in a namespace object
16:51a_strange_guywhich can be used to import classes
16:51a_strange_guybut that is your own risk
16:51StartsWithKi need to generate a bytecode and import my class after that
16:52StartsWithKand i made all the generators as functions
16:52StartsWithKwell.. back to the old drawing bord
16:52a_strange_guybe evil, use eval
16:53StartsWithKhehe, eval will not work as
16:54StartsWithK(defclass Foo) (use-Foo) and if defclass expands to (do (make-a-bytecode) (eval (import)) (use-Foo)
16:54StartsWithKuse-Foo will not see Foo
16:55a_strange_guyactually it might
16:56a_strange_guy'do at toplevel works like in a lisp interpreter
16:58StartsWithKit worked :)
16:58a_strange_guybut it will only at toplevel
16:58StartsWithKwait :)
17:00StartsWithKit worked as (do (eval '(import javax.swing.JFrame))) (println (JFrame. "hi"))
17:00StartsWithKhmm, but i will need to make it a macro to get that
17:00StartsWithKpff
17:01a_strange_guyit won't AOT though
17:01a_strange_guyAfaik AOT is the reason, why import is not a function anymore
17:02a_strange_guyif you don't want to use eval
17:02StartsWithKit compiled
17:02a_strange_guytry: (do (.importClass *ns* full.class.Name) (use-Name))
17:03a_strange_guyreally?
17:03StartsWithK(defn foo [] (eval '(import javax.swing.JFrame))) (foo) (println (JFrame. "hi"))
17:04StartsWithKi'll use this for now, easy to fix later
17:04a_strange_guydidn't mean it that way
17:04StartsWithKthanks
17:04a_strange_guyhave fun
17:05a_strange_guyand hope nobody will see that hack xD
17:07StartsWithK:)
17:24hsjunnessonOkay, so I have a class I want to dynamically instance by picking out its constructor and calling newInstance on it. Problem is this constructor has mixed primitive and object arguments.
17:24hsjunnessonThis is when it gets tricky.
17:26hsjunnessonSo I'm trying something like (.newInstance c (into-array Object [foo bar])) and get an IllegalArgumentException.
17:26_brian2_any congomongo users out there?
17:26a_strange_guyclojure.lang.Reflector
17:27a_strange_guyRich built the hacks, so you don't have to
17:27hsjunnessonI'll take a look, thanks :)
18:13_brian2_noob question > I would like to use the 'partition' function in the contrib library 'string' , however the docs say to use : (require '[clojure.contrib.string :as s]) , but there is no string.class in my contrib jar file
18:17_brian2_this doesn't seem to work either : (use '[clojure.contrib.str_utils])
18:18a_strange_guywhat version are you using?
18:20_brian2_clojure-contrib-1.0-20091212.214557-33.jar
18:20_brian2_clojure-contrib-1.0-20091212.214557-33.jar
18:20_brian2_clojure-contrib-1.0-20091212.214557-33.jar
18:20_brian2_sorry
18:30Lajla,((set "ab") a)
18:30clojurebotjava.lang.Exception: Unable to resolve symbol: a in this context
18:30LajlaEurr
18:30Lajla,((set "ab") #\a)
18:30clojurebotNo dispatch macro for: \
18:30a_strange_guy,((set "ab") \a)
18:30clojurebot\a
18:30Lajlaa_strange_guy, merci.
18:35Rayneshttp://gist.github.com/427949 Anybody have any clue what might cause something like this to explode? I can't read that error to save my life, and I'm running out of options. The relevant code is in this area: http://github.com/Raynes/sexpbot/blob/master/src/sexpbot/respond.clj#L91
18:36RaynesWhat's weird about it, is this error only occurs when sexpbot isn't ran inside an REPL. If you run it in an REPL, everything works smoothly.
18:37RaynesWhat is happening, is sexpbot is trying to reload all of the plugins (quite literally, it's requiring all of the plugins with :reload), and then it's calling a function in all of the plugins that the defplugin macro creates. It's inside this function, I believe, where everything is blowing up. The error doesn't make any sense to me.
18:37RaynesLicenser and I have been trying to work it out, but we're lost. :\
18:38RaynesThe most insane thing is that it works if sexpbot is ran in the REPL, but not if ran via java -cp "lib/*:src/" clojure.main -e "(use 'sexpbot.run)"
18:40RaynesWhen sexpbot starts up, most of this happens. When it starts up, require-plugins is called, followed by stuff to create bots for each server in the configuration, and both load-plugins and load-modules are called on these. So, it works the first time everything is loaded, but not when it's reloaded.
18:40rhickeyRaynes: are you on the latest Clojure? Is anything AOT compiled?
18:40Raynesrhickey: I actually haven't grabbed the latest snapshot in a couple of days, but I am running 1.2, and nothing is AOT compiled.
18:40rhickeytry the latest
18:41RaynesThis will take a little while. /me is on dialup.
18:41programbleuh
18:42programbles/</>/
18:42sexpbotuh
18:42programble...
18:42programblesed doesn't work with actions?
18:42programbleon purpose or accident
18:42programbleon purpose makes sense actually
18:42programblefor example
18:43programbles/his thumb/<insert dirty object here>/
18:43sexpbotfor example
18:43programbleanyway
18:43programblei should shut up now
18:43_brian2_can anyone tell me if contrib 'strings' is now str_utils ?
18:53_brian2_I'm trying to use the string library 'partition' function, but when I run the example : (partition #\"[a-z]+\" \"abc123def\") , I get No dispatch macro for: \
18:56TweyIs there a function (comp eval (partial cons 'hash-map)) defined in the standard library somewhere?
18:56programble_brian2_: why do you have the slash?
18:57Twey(actually, there's probably a function (comp eval (partial cons)) somewhere, isn't there?)
18:57programble_brian2_: (partition #"[a-z]+" "abc123def")
18:57TweyOh, no ‘partial’ allowed there? Okay
18:58_brian2_the slash is in the example
18:59TweyAh, ‘apply’
18:59programble_brian2_: well it shouldn't be
18:59TweyOkay ☺ I guess there's not much need for a (partial (apply 'hash-map)) somewhere, then.
18:59_brian2_For example: (partition #\"[a-z]+\" \"abc123def\") returns: (\"\" \"abc\" \"123\" \"def\")"
19:03programble_brian2_: remove all those \s
19:04_brian2_ok
19:04_brian2_you mean \ 's ?
19:05programbleyes
19:05programblei have no idea why they are there
19:05programblebut they shouldnt be
19:06_brian2_ok
19:06_brian2_thnks!
19:07Raynesrhickey: Same thing.
19:07RaynesI guess I've superbroke this thing. I break things a lot, that isn't surprising. The confusing part is how it works when sexpbot is run in an REPL, but not otherwise. That's the part that has me beating my head against a wall.
19:10hiredmanRaynes: have you lein clean'ed lately?
19:13RaynesYeah, that didn't help.
19:14hiredmanRaynes: is sexpbot.respond$defplugin$fn__3456 the same all the time?
19:15RaynesEr, I'm not entirely certain what that is.
19:15hiredmanit's a class name
19:16hiredmanis it always the same in the exception?
19:16RaynesLet me check.
19:16hiredmandid you not just rerun it after doing the clean?
19:16Rayneshiredman: No. It changes.
19:16hiredmanmmm
19:16hiredmaninteresting
19:17RaynesIt's insane.
19:17RaynesAt least, it's driving me insane.
19:17hiredmanand how do you know line 91 is the line you are looking for?
19:19hiredmanat sexpbot.plugins.spellcheck$eval3699$load_this_plugin__3700.invoke(spellcheck.clj:37)
19:19RaynesBecause after everything has been reloaded, the bot calls a function that the macro creates in each of the plugins, and this sets up the commands and such. It's in this function where everything explodes. I know, because I placed two printlns in there; one before the dosync, and one as the first thing in the dosync. The first one always executes, but the second one never does, so apparently the dosync is blowing up.
19:19hiredman,(str (fn []))
19:19clojurebot"sandbox$eval__8952$fn__8953@d85839"
19:20Rayneshiredman: spellcheck is the first plugin that sexpbot is trying to load.
19:20hiredmanthe stacktrace says it is on line 37, and 37 is a macro
19:20Rayneshttp://github.com/Raynes/sexpbot/blob/master/src/sexpbot/respond.clj#L129
19:20hiredmanthe macro is like 118
19:21hiredmanrhickey asked about aot, right?
19:21RaynesYeah.
19:21RaynesNone of that is going on.
19:22hiredmanand which line in the macro is the exception happening?
19:23RaynesI suspect it's the line that I linked to above. Like I said, I can put a println right before the dosync, and it executes and prints right. Anything in the doseq never happens.
19:23Raynesdosync*
19:25hiredmanreally?
19:25RaynesTotally.
19:25hiredmanprove it
19:25Rayneshiredman: http://gist.github.com/427949
19:25Raynes"Works!!!"
19:26hiredmanRaynes: missing a gist with the altered code
19:26Rayneshttp://gist.github.com/427949
19:26RaynesOops.
19:26RaynesWrong link.
19:26Raynes http://gist.github.com/428024
19:28hiredmanyou are doing this on a fresh run of the code right?
19:28RaynesYessir.
19:28RaynesEvery time.
19:28hiredmanreally?
19:29RaynesI promise.
19:29Raynes:\
19:29hiredmanat sexpbot.plugins.spellcheck$eval3699$load_this_plugin__3700.invoke(spellcheck.clj:37) is the exact same in this exception
19:29hiredmaner
19:29hiredmanwrong line
19:29hiredmansexpbot.respond$defplugin$fn__3456
19:29RaynesI'll do a fresh run right now.
19:30hiredmanthat may not be much of indicator, because gensym may use successive numbers
19:30Rayneshttp://gist.github.com/428028
19:30hiredmanso you would always get the same one in the same place unless you add a new call to gensym
19:32hiredmancan you aot compile it?
19:33RaynesEverything?
19:33hiredmanif you remove the dosync block, do you still get the exception?
19:33Rayneshiredman: Nope. If I remove the dosync, no exception happens.
19:33RaynesI tested that way earlier.
19:34RaynesGuess I should have mentioned that.
19:34hiredmanoh
19:34hiredmanyou are using #() inside a macro expansion
19:34hiredmandon't do that
19:34RaynesOkay.
19:38hiredmanwell?
19:38RaynesThat didn't fix it.
19:38RaynesWere you wanting me to AOT compile this?
19:38hiredmanand the exception is still the same?
19:38RaynesYup.
19:39Rayneshttp://gist.github.com/428035
19:39hiredmancan you put in a (println m-name#) before the dosync
19:40RaynesKay.
19:41Rayneshttp://gist.github.com/428036
19:41RaynesThat seems to be in proper working order.
19:44hiredmanhave you tried intern instead of def
19:44_brian2_I have a re-seq question, I want to parse out "{aa}{bb}" ->"aa" "bb" but this (re-seq #"\{.+\}" "{aa}{bb}") yields ("{aa}{bb}")
19:45hiredmanhas this code ever worked?
19:45Rayneshiredman: Instead of using defn to create load-this-plugin? No, I haven't tried this.
19:45Rayneshiredman: The code changed a little, but it used to work.
19:45hiredmanwhat changed?
19:46Rayneshiredman: I got rid of the global commands, modules, and hooks refs, and put them all in the irc ref that is passed to the function. Also, the function is new.
19:47hiredmanRaynes: that doesn't sound like a little
19:48Rayneshiredman: The only real thing that has changed is that things are stored in a single ref instead of many global refs, and the stuff that actually stores it is wrapped in a function. It's really not that different.
19:50RaynesAs a side note, the same thing happens when intern is used.
19:51RaynesI guess I've just borked things beyond repair.
19:51RaynesI just don't understand how. :\
19:51hiredmanso some how a string with "sexpbot.respond$defplugin$fn__3456" in it is being passed to read-string
19:52hiredmanwell, RT/readString
19:52hiredman,(read-string "sexpbot.respond$defplugin$fn__3456")
19:52clojurebotsexpbot.respond$defplugin$fn__3456
19:52hiredmangrrr
19:52hiredmansomething like that, but it throws an exception
19:53hiredmanuser=> (clojure.lang.RT/readString "#=sexpbot.respond$defplugin$fn__3456")
19:53hiredmanjava.lang.RuntimeException: java.lang.ClassNotFoundException: sexpbot.respond$defplugin$fn__3456 (NO
19:53hiredman_SOURCE_FILE:0)
19:53hiredmanuser=>
19:56hiredmanyou may want to look at the macro expansion of defplugin and the contents of irc
19:56RaynesWhat annoys me the most is how it works fine in an REPL, but not outside of one.
19:56RaynesI'd much prefer that it not work anywhere.
19:57RaynesAt least then it would be easier to test.
20:00zakwilsonI'm having difficulty using Swank remotely with leiningen. As far as I can tell, it can't find dependencies that are in jars when I try to use them in my code.
20:01Rayneshttp://gist.github.com/428048
20:02korrezakwilson: are you doing a war project?
20:03zakwilsonI should add that I'm starting Swank by connecting over ssh and running "lein swank" manually. I briefly tried remote-swank, but it didn't seem to work.
20:04zakwilsonkorre: I don't know what a war project is. What I'm doing originally was going to be for appengine, and has a war directory.
20:04korrezakwilson: butt it is using a custum lib path?
20:07zakwilsonkorre: yes
20:08korrezakwilson: try to copy the jars a lib folder on your project root and restart the swank server
20:08zakwilsonkorre: there's already a symlink to the lib directory in the project root. Should I remove the custom lib path in project.clj?
20:09korrezakwilson: yea and run lein deps agen
20:11zakwilsonkorre: tried that, still get FileNotFoundException
20:23zakwilsonNo difference when using an ssh tunnel
20:26korreso you hawe time to github it??
20:26hiredmanRaynes: the value of :cleanup looks suspicious
20:27Rayneshiredman: It's the only thing that I haven't tried commenting out so far.
20:28Rayneshiredman: Okay, changing it to (fn [] 0) caused the error to not occur.
20:28Rayneshiredman: cleanup is the culprit.
20:28RaynesNow, I need to figure out why.
20:29hiredmanit's a an object that can't be read
20:29Raynes~ is passing it to readString?
20:29clojurebotGabh mo leithscéal?
20:29Raynesclojurebot: Shush, we're trying to fix your sister.
20:29clojurebotIt's greek to me.
20:31zakwilsonkorre: was that directed at me?
20:32korreyea
20:34zakwilsonhttp://github.com/zakwilson/test-classpath <-- this actually seems to fail locally too
20:35korrezakwilson: only a project.clj file on github :p
20:37zakwilsonkorre: correct. I tried to make it is simple as possible. One should be able to "lein deps", "lein repl" and (use 'compojure.http)
20:37korrezakwilson: if you hawe the newest version of swank you dont need the lein swank plugin
20:38zakwilsonkorre: I had some reason for keeping it around. I think it wasn't working without it.
20:39zakwilsonHmm... works without it now.
20:39zakwilsonBut (use 'compojure.http) fails
20:41korrethere is no compojure.http in this version!
20:41korrepatrik-karlins-MacBook-Pro:lib patrikkarlin$ unzip compojure-0.4.0-20100308.145053-8.jar
20:41korreArchive: compojure-0.4.0-20100308.145053-8.jar
20:41korre inflating: META-INF/MANIFEST.MF
20:41korre inflating: meta-inf/maven/compojure/compojure/pom.xml
20:41korre inflating: meta-inf/maven/compojure/compojure/pom.properties
20:41korre inflating: compojure/route.clj
20:41korre inflating: compojure/response.clj
20:41korre inflating: compojure/core.clj
20:41korre inflating: compojure/.response.clj.swp
20:41korre inflating: compojure/.route.clj.swp
20:41korre inflating: project.clj
20:41korrepatrik-karlins-MacBook-Pro:lib patrikkarlin$
20:43zakwilsonThen it seems that the contents the jar changed
20:43korremush of compojure has been refractord out i think..... what did you whant from the http libary?
20:45zakwilsonI think it was defroutes and defserver. I was also using compojure.html, which isn't there either.
20:46korreno theres a diferent libary for the html dsl
20:46arbschthiccup
20:46korredefroutes is in compojure.core
20:49zakwilsonThis is what I get for using an unstable version. Not sure why I did that. I got a trivial web version of my app working and then left it alone for a while as I tried to chase down parallelism performance issues
20:49korre[hiccup "0.2.5"]
20:49durka42anyone using penumbra? i'm having trouble with textures
20:50Rayneshiredman: Problem was a missing syntax quote. ._.
20:52zakwilsonkorre: thanks for the help. It might have taken me forever to notice the changes to compojure otherwise.
20:53arbschtzakwilson: try #compojure too, btw
20:53zakwilsonIt has its own channel?
20:54arbschtyes
20:55Rayneshiredman: Thanks for all the help. I appreciate you taking the time to work with me on this one. It was a tough one. <3
21:04zakwilsonSo I have some code I started on about a month ago and it uses the params function. Compojure was recently restructured, and that function is not in compojure.core. Where has it gone, or what has it been replaced by?
21:07korrezakwilson: what did it do?
21:08korrezakwilson: http://github.com/weavejester/compojure/blob/master/src/compojure/core.clj compojure isent that big :p
21:09zakwilsonkorre: it looked up query parameters
21:09korrezakwilson: query ..... you mean url parameters ?
21:10zakwilsonkorre: yes
21:10korrezakwilson: its in ring.middleware
21:11korre(:use [ring.middleware params cookies]
21:13zakwilsonGreat... now Emacs seems to have locked up
21:17zakwilsonkorre: this hasn't given me back the params function, though it's obvious that ring.middleware.params is for doing stuff with params. Oh, there's actually documentation for this. Cool. I wonder where I might find decent example code though.
21:18korrezakwilson: http://github.com/mmcgrana/ring/blob/master/ring-core/test/ring/middleware/params_test.clj
21:20zakwilsonThis is more verbose than the old params function. I wonder what prompted the change.
21:22zakwilsonOh, wait. I see. It's gone because the Right Thing is to specify the params in the route.
22:25brehautim trying to get the emacs-starter-kit going on my mac; only problem so far is git complaining during clone with "Cannot obtain needed blob 94a9ed024d3859793618152ea559a168bbcbb5e2
22:25brehautwhile processing commit 6b38e16eaf847cee27c8b3fdf58d8bb88af5caf3.
22:25brehautfatal: Fetch failed." – does anybody know how to fix/route around this?
22:28ravawhat's an elegant way of returning a json array of json objects from a list of maps?
22:28ravabut without returning a lazy list (compojure's render doesn't like it :/ )
22:31zakwilsonIt seems that Compojure used to have a serve-file function, and this is now gone. What's the idiomatic way to serve a static file now?
22:39ravaset headers and return the file?
23:08trptcolinhow can i access a java enum with clojure?
23:09trptcolini can get it as a class: org.apache.cassandra.thrift.ConsistencyLevel
23:10trptcolinbut none of the access mechanisms that i can think of work (.ONE org.apache.cassandra.thrift.ConsistencyLevel) or (org.apache.cassandra.thrift.ConsistencyLevel.ONE)
23:11trptcolinhrm, actually this seems to work: (. org.apache.cassandra.thrift.ConsistencyLevel ONE)
23:11trptcolini'd thought that was just syntactic sugar...
23:22ravatrptcolin: what did you think was sugar?
23:22chouserdid you try org.apache.cassandra.thrift.ConsistencyLevel/ONE
23:23trptcolinchouser: ah, much better :)
23:23trptcolinthx
23:24trptcolinthat makes sense, so enum members are treated just like statics...
23:25trptcolinrava: the bare .
23:37ravatrying to join the return of mapping a function across a items in a list to an existing string..any nice way of doing that?
23:41trptcolin,(str "existing string" (clojure.contrib.str-utils/str-join "" [1 2 3]))
23:41clojurebotjava.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.contrib.str-utils