#clojure logs

2010-01-25

00:01tolstoywhat does "keep an index" mean? Adding up something for each row? (Which could be done in SQL itself, which is why I'm confused.)
00:01somniumnosql!
00:01alexyktolstoy: it's not SQL, it's mongo!
00:01alexykgetlostsql!
00:01tolstoyHeh.
00:02tolstoyI guess I was thinking that you could have a fn that took a row, and a results map, and returned a new map with the row's data added in (as necessary).
00:02tolstoyThen just use reduce.
00:02tolstoyI mean, map reduce, eh?
00:03alexykreduce works, but somehow I found that passing around the transient res is not much speedup
00:03alexykthe while works a transientr
00:03tolstoyAh, so, you're past getting it work. Now you want to do the ugly optimization? :)
00:04somniumcan just move the while condition into a when in loop-recur?
00:04alexyksomnium: forgot how loop looks :)
00:04alexyk(doc loop)
00:04clojurebot"([bindings & body]); Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein. Acts as a recur target."
00:05alexykha -- 1.1.0 sends to RTFurl
00:05tolstoyThat explanation is nice and clear.
00:05alexykso where do we inc some i?
00:06alexykin the binding?
00:06tolstoy(loop [i 0] ..... (recur (inc i)))
00:07alexykah ok
00:07tolstoymaybe (loop [cursor (init) i 0] .... (recur cursor (inc i)))
00:08tolstoy(let [cursor (init)] (loop [i 0} ... (recur (inc i))) ;; no idea what's better style, or faster. Heh.
00:08somniumthe cursor mutates on its own, so no sense in passing it
00:08alexykyep
00:08tolstoyright
00:08somniummaybe the JIT can handle those details
00:16alexykso if loop doesn't see recur, it just falls through, as let?
00:16somniumyeah, no complaints from the compiler
00:17somniummaybe well get real TCO some day off in the future (or a clojure-in-scheme implementation)
00:20wiligtechnomancy: Mind if I try my hand at some of the tickets on swank-clojure?
00:20hiredmanthere are patches that add tailcalls to the jvm already
00:22alexykhow do I check that something is a number?
00:22hiredman(doc number?)
00:22clojurebot"([x]); Returns true if x is a Number"
00:23somniumhiredman: ooh, any jvm-download to play with?
00:24alexykthx
00:25hiredmansomnium: no, and it's not automatic tailcalls, you have to emit special bytecode so the clojure compiler would need to add support for it
00:26hiredmanhttp://weblogs.java.net/blog/forax/archive/2009/12/18/tailcall-anyone
00:27somniumgood timing for ccinc at any rate
00:29hiredmancinc could happen right now, it's just a matter of priorities
00:31hiredmanit could have happened even earlier too, I think rhickey is just focused on making clojure "good" and cinc is just a subgoal
00:32somniumI wonder if the java regex syntax will linger once clojure is on multiple platforms
00:32hiredmanclojure is tied to the jvm
00:32somniumIm mostly interested in seeing what the 'kernel' comes out looking like
00:32hiredmanI don't that will change
00:32hiredmandoubt
00:33hiredmanthe clr version is also "clojure" it is "clojure.NET"
00:33hiredmaner
00:33hiredmanthe clr version is not
00:33hiredmanbleh
00:33somniumIm not terribly concerned with how its called :)
00:34somniummore what it can do and how its different
00:37hiredmanthe point is the clr version is different
00:38somniumah, so you mean clojure on the jvm is unlikely to change
00:38hiredmanit's unlikely to change its regex support
00:39somniumdoes the clr use the same regex notation? (I have no idea what .NET regex is like)
00:39hiredmanI think I recall seeing in an email dmiller talking about adding someway to specify stack allocation on the clr
00:39hiredmanthe jvm doesn't support that so clojure can't do that
00:40hiredmanclojure.net can
00:40hiredmanI don't know too much about clojure.net either
00:40alexyksomnium: I got the name of the option to dissoc :_id :_ns!
00:40hiredmaninfact, it may actually be called clojureCLR
00:41somniumccinc should make it easier(possible) to support those kind of host-specific special forms
00:41somniumjust a new ticket on assembla a few days ago I saw
00:42alexykdismongo
00:42somniumalexyk: sounds like a tropical ailment
00:42alexykMicrosoft Clojure# 7
00:42somnium:D
00:43alexyknow with ActiveFn(tm)
00:44alexykand family license pack, up two repls on a Windows 7 locla network
00:46hiredmanWindows Evaluator Explorer
00:46hiredmanWEE!
00:50somniumwhat to call a scheme-to-C impl? PLTClojure is just not sexy
00:50somniumcleme
00:50alexykclo#ure
00:50somniumhow do you pronounce that one?
00:51alexyk"violate the EULA and go to jail == #" :)
00:52somniumI worked in at least one office that kept a a lone copy of XP locked in a storage closet
00:54alexykis there a core fun to return a seq with nth element removed?
01:00alexyk,(letfn [(without [s n] (concat (take n s) (drop (inc n) s)))] (without (range 10) 4))
01:00clojurebot(0 1 2 3 5 6 7 8 9)
01:25alexykI can manually destructure a map and convert it to a vector like below. Now what if the keys is a parameter?
01:25alexyk,(let [{:keys [a b]} {:a 1 :b 2}] [a b])
01:25clojurebot[1 2]
01:25alexykI can say :keys myparam, but what do I stick into the body?
02:10LauJensenMorning team
02:16replacahey lau
02:54webbenDoes anyone know what's happening with Waterfront? Did it cease development early last year?
02:59somniumI think the developer started using emacs
03:00webbenah interesting
04:00AWizzArd~seen rhickey
04:00clojurebotrhickey was last seen quiting IRC, 287 minutes ago
04:11esjMorning all
04:11esjNickserv is a bit feisty this am.
04:14cgrandesj: Morning
08:25G0SUBneed help with enlive...
08:26G0SUBonce I have used select to get a part of a page, can I run select on the selection again?
08:26G0SUBthat capability will be really useful.
08:38cemerickG0SUB: yeah, that shouldn't be a problem
08:38cemerickselect is just working over a tree of nodes, and returns a tree of nodes, so those operations can be composed at will
08:39G0SUBcemerick: well, it didn't work for me. may be I did something wrong.
08:39G0SUBcemerick: also, I need to use an nth-child selector. is that possible?
08:40cemerickG0SUB: one sec, I'll see if I can get a simple example together
08:40G0SUBcemerick: sure. many thanks.
08:52cemerickG0SUB: yeah, super-easy: (-> "http://www.penny-arcade.com/comic/" java.net.URL. html-resource (select [:div]) (select [:a]) count)
08:53cemerickthat gives all links that are descendants of divs
08:53G0SUBcemerick: looking
08:54cemerickI've not used nth-child, but I'll assume that that will drop in however you'd expect
08:54cemericke.g. to parallel how CSS works, that is
08:55cemerickG0SUB: yeah, changing the first select to (select [[:div (nth-child 3)]]) yields a count of matching links of 14, rather than 67
08:56cemerick(not positive that's correct, but seems perfectly reasonable)
08:56G0SUBcemerick: the nth-child syntax is interesting
08:57cemerickG0SUB: interesting, as in different than the analogous css?
08:58G0SUBcemerick: yes. and is it documented?
08:58cemerickcgrand: parenthetically, why take nodes as the first argument to select? I *really* want to use ->> and drop a bunch of maps and then a reduce on the end of a series of selects.
08:58G0SUBcemerick: +1
08:58cemerickG0SUB: here, I think: http://enlive.cgrand.net/syntax.html (linked from http://wiki.github.com/cgrand/enlive/)
08:59G0SUBcemerick: ah
09:01cgrandcemerick: G0SUB: because select predates ->> :-)
09:01cgrandyou can always use the -> ->> combo
09:01G0SUBcgrand: hehe :)
09:02cemerickcgrand: boo! ;-)
09:02cgrand(-> url (select XXX) (select YYY) (->> (map foo) (reduce bar zero)))
09:03chouseroh. my.
09:03chouserWhy had I never considered putting a ->> inside a -> ?
09:04cemerickyeah, that's a new one on me, too :-)
09:04cemerickcgrand: anyway, I'd +1 swapping the arg order if you're game.
09:06cgrandI'd like to modify -> and ->> to make the recognize each other so as to switch between thread first and thread last
09:06cgrandso my latest snippet would become (-> url (select XXX) (select YYY) ->> (map foo) (reduce bar zero))
09:07cemerickhuh
09:07cemerickso crazy, it just might work.
09:09chouserwhy not just have each fn (since they can hold metadata now) declare its threading arg position, then have a single universal ->
09:09cemerickchouser: that's not too magical?
09:10chouserdefinitely too magical.
09:10cgrandOne of my pet peeve is that one can currently upgrades a thread-first to a thread-last using the ->> inside a -> trick. The other way is impossible.
09:11cgrandchouser: it may break some existing code but it's an interesting idea
09:16chouserI guess my postfix locals example would quit working.
09:19jcromartiewhat's the best way to make a map from a seq?
09:19chouserjcromartie: depends on the shape of the seq
09:19chouserjcromartie: ([:a 1] [:b 2])? (:a 1, :b 2)? ((:a :b) (1 2))?
09:20jcromartieit's a seq of hash-maps
09:20chouserso ({:a 1} {:b 2, :c 3}) and you want {:a 1, :b 2, :c 3}?
09:20jcromartieand value of one of the keys of these maps will become the key for the new hash-map
09:20jcromartienot quite
09:21jcromartie({:a "foo", :b 2}) would become {"foo" {:b 2}}
09:21jcromartieI'm thinking reduce
09:22chouserI think I need more info. Is :a another input to this function, or else how is it treated differently from :b?
09:22chouserbut yes, likely reduce or into
09:22jcromartiegot it
09:23jcromartie(reduce (fn [x v] (assoc x (:name v) v)) {} @*venues*)
09:23jcromartieBTW, (doc reduce) doesn't mention it, but is there a lazy version?
09:23chousercan't be
09:24jcromartieoh?
09:24chouserin this case, for example, you're producing a map. Map objects aren't lazy.
09:24jcromartieyah
09:24jcromartienevermind then :P
09:24chouser:-)
09:24jcromartieI suppose if I were producing a seq I'd be using map
09:26chouserthis might work too: (into {} (for [v @*venues*] [(:name v) v]))
09:27cgrandjcromartie: shouldn't you dissoc :name too?
09:27jcromartienot in this case
09:30jcromartieactually I'm kind of torn on how to store this
09:30G0SUBcgrand: I am trying to scrape the Company column from http://money.rediff.com/tips/2010/01/20
09:30G0SUBcgrand: code is here ... http://paste.lisp.org/display/93872
09:30jcromartieI guess if order doesn't matter it's probably best to store a hash-map of ids, if I will be accessing it by id most often
09:30G0SUBI am not sure why I am getting all these nils
09:31G0SUBany advice will be appreciated.
09:31G0SUBI think my selectors are wrong
09:31jcromartiethe content is displayed by JS
09:31jcromartiecould that be why?
09:31G0SUBjcromartie: yes, but there is some markup.
09:32G0SUBjcromartie: I am getting the data, but some extra nils. that is the problem.
09:33G0SUBI am not sure if I am using nth-of-type correctly
09:34chouserjcromartie: btw, what you've got is very close to (clojure.set/index @*venues* [:name])
09:34jcromartiehmm
09:34jcromartieinteresting
09:35jcromartieI'll check it out, that's probably better for my case
09:35chouserthe keys look like {:name "foo"} though, rather than just "foo"
09:36jcromartiehmm
09:40cgrandG0SUB: looking at it right now, the nil are cause by the selection of the "View" links, looking what's wrong with those selectors
09:40G0SUBcgrand: thanks. I am investigating too.
09:44cgrandG0SUB: ok, found it, let me paste it
09:48cgrandG0SUB: http://paste.lisp.org/display/93872#2 the problem was with (select [:td (nth-of-type 1)])
09:49G0SUBcgrand: ah, I never understood the syntax properly. many thanks.
09:49cgrandCSS numbering starts at 1
09:49G0SUBcgrand: btw, is there anyway the :a selector can be combined with the :td one?
09:51cgrandand in [:td (nth-of-type 1)], (nth-of-type 1) applies to a descendant of :td not to td itself, you have to wrap them in a vector to have a "and" (while the outermost selector always mean chaining)
09:51G0SUBcgrand: understood now. thanks a lot.
09:52cgrandG0SUB: just (select [[:td (nth-of-type 1)]]) to (select [[:td (nth-of-type 1)] :a])
09:53cgrand(and remove the other select of course)
09:53G0SUByeah
09:53G0SUBthe issue was with the nested vector
09:53cgranderr I mean (select [[:td (nth-of-type 2)] :a]) with a 2 not a 1
09:54G0SUBcgrand: got it :)
09:56G0SUBcgrand: is there an easy way to select the :content directly? something like text in xpath?
09:58cgrandG0SUB: sure: text for a single node or texts for a seq of nodes
09:58G0SUBok
09:59cgrand(-> url (select XXX) texts)
10:01G0SUBcgrand: is texts public?
10:02cgranddid you get enlive from clojars?
10:02G0SUByes
10:04cgrandoops, it is slightly out of date
10:04G0SUBcgrand: can you kindly push a new version?
10:05cgrandbut texts is simply (defn texts [nodes] (map text nodes)) and you have #'text, right?
10:05cgrandG0SUB: not right now, I'm sorry
10:06G0SUBcgrand: no problem.
10:06G0SUBcgrand: yes, but I want to get rid of the unnecessary map
10:07cgrandin the mean time, use your own "texts" (pasted above) or get enlive from github
10:07cgrand"the unnecessary map"?
10:09G0SUBcgrand: the map to get the texts inline. anyway, I will write my own texts. thanks.
10:12cemericknice
10:12cemerickstuartsierra: I've got a rough patch for duck-streams that adds a dispatch to reader for Seqable -- interested?
10:15G0SUBhow do I do a case insensitive regex matching in Clojure?
10:15cemerickG0SUB: use the 'i' flag in your regex
10:16G0SUBcemerick: any examples?
10:16chouser#"(?i)foo"
10:16G0SUBok
10:18cemerickabout the only thing I miss from python's is named groups
10:19chouseryeah. but hardly anything has named groups
10:20chouserI once chose python for a project exclusively because of the named groups. They were needed for the little DSL I wanted.
10:21jcromartieI still can't believe that the iPhone SDK doesn't ship with any regex capabilities.
10:21cemerickchouser: I mean the feature where you can name capturing groups, and retrieve them by their name, rather than idx.
10:22cemerickstuff like the numeric regexes in the reader scream for something like that
10:23stuartsierracemerick: how does it convert a Seqable to a reader?
10:25cemericklisppaste8: url?
10:25cemerickthe bot is dead :-/
10:26cemerickstuartsierra: http://paste.lisp.org/display/93877 compose-paths would need to turn into a multimethod dispatching on the first arg -- the String case would reuse URL/File creation bits from the String case of reader.
10:27chousercemerick: yes
10:27chousercemerick: I knew exactly what you meant
10:28cemerickchouser: ah, I didn't grok the 'hardly anything' msg.
10:28chouserI mean, almost no regex engines support the named groups
10:28cemerickright, I get what you were saying now
10:29cemerickPython's is the only one I know of.
10:29cemerickand the regex engine I wrote :-P
10:29chouserthe syntax is ugly, but that's hardly new for a regex feature. :-P
10:29cgrandchouser: cemerick: http://paste.lisp.org/display/93878 :-P
10:29stuartsierracemerick: So the idea is that (reader ["foo" "bar" "baz"]) would return (BufferedReader. (FileReader. (File. "foo/bar/baz"))) ?
10:30cemerickstuartsierra: roughly, though File/URL would handle the canonicalization.
10:31cemerickcgrand: Looks nifty. Forgot contrib.core/-?> and (soon to come, hopefully) -?>>
10:32cemerickThat's the only downside to parsing the forms, I suppose.
10:32stuartsierracemerick: I dunno, that looks a bit too magical to me.
10:32cemericki.e. having to be explicit about which threading forms are supported
10:33cgrandcemerick: unless you register them all in a *threading-forms* var
10:33cemerickstuartsierra: heh, fair enough
10:33cemerickcgrand: I think you forgot the ;-) in that one
10:33cemerick;-)
10:34chouserhm... would these all play nicely with destructuring-> ?
10:35cemerickstuartsierra: I've just been accumulating seqs of file paths all over the place, and doing (-> some-seq path-norm-fn slurp*) too much. :-)
10:35cgrandchouser: is your patch on assembla?
10:35stuartsierracemerick: doesn't c.c.java-utils/file do that?
10:35chousercgrand: http://www.assembla.com/spaces/clojure/tickets/211
10:35chouserI think it might "just work"
10:37cgrandchouser: me too
10:37cgrandmore destructuring fun! ;-)
10:39cgrandchouser: btw I realized that -> and ->> could be shadowed but thankfully we have &env now
10:39jcromartieis it OK to throw exceptions in clojure
10:39jcromartie?
10:39cemerickstuartsierra: didn't know about that, but file doesn't handle URLs *shrug*
10:40jcromartieI don't really see any special attention paid to it in the docs
10:40alexottis anybody know - who now maintains clojars? mail, specified at site isn't working
10:41chouserjcromartie: sure, throw try and catch all work
10:41jcromartieah, throw is a special form, then?
10:41chouseryes
10:41jcromartieI was expecting a macro or function ("Unable to resolve symbol: throw in this context") in my search
10:42cemerickhuh, I didn't notice as-url before though
10:42jcromartiefun with throw...
10:42jcromartie,(throw)
10:42clojurebotjava.lang.NullPointerException
10:42chouserheh. reasonable default. :-)
10:42jcromartiethat's the worst thing in Java, hands down
10:42chouser,(throw (Exception. "do not want"))
10:42clojurebotjava.lang.Exception: do not want
10:44jcromartiewhere are the various REPL vars documented?
10:46stuartsierrajcromartie: dysinger maintains clojars I think
10:46jcromartiewrong guy, stuartsierra
10:46jcromartiealexott:
10:46stuartsierraoh
10:46stuartsierraright
10:46jcromartie*1 *2 *3 *e
10:46jcromartieis that it?
10:49stuartsierra*warn-on-reflection*
10:50stuartsierra*print-dup*
10:53jcromartiethose arent' repl-specific, though
10:54jcromartiehow long has *print-dup* been around?
10:54jcromartieI ran into some issues printing cycles
10:55stuartsierra*print-dup* has been around for a long time, not well documented
10:55jcromartiehmm, but I guess *print-dup* doesn't do what I think it does
10:55stuartsierraI don't think Clojure can print cycles.
10:55alexottstuartsierra: thanks, i'll write to him
10:56stuartsierraalexott: Oh, wait, there's someone else
10:56stuartsierra"_ato" I think
10:56stuartsierraWhoever that is.
10:57jcromartie,(let [x (ref {}) y (ref {})] (dosync (alter x assoc :y y)) (dosync (alter y assoc :x x)) x)
10:57clojurebot#<Ref@ff78e9: {:y #<Ref@5b1cff: {:x #<Ref@ff78e9: {:y #<Ref@5b1cff: {:x #<Ref@ff78e9: {:y #<Ref@5b1cff: {:x #<Ref@ff78e9: {:y #<Ref@5b1cff: {:x #<Ref@ff78e9: {:y #<Ref@5b1cff: {:x #<Ref@ff78e9: {:y #<Ref@5b1cff: {:x #<Ref@ff78e9: {:y #<Ref@5b1cff: {:x #<Ref@ff78e9: {:y #}>}>}>}>}>}>}>}>}>}>}>}>}>}>}>
10:57jcromartieclojurebot: was that fun?
10:57clojurebotNo entiendo
10:57jcromartieI find it interesting that it stops at some point
10:57chouserjcromartie: http://paste.lisp.org/display/83647
10:58chouserjcromartie: the {:y #} is because of *print-level*
10:58jcromartieah
10:59jcromartiehandy
11:01DeusExPikachuwhen structuring a lib, for example, (ns foo (:use bar.core)), clojure tries to load /foo/core, instead of /foo/core.clj, any other filename except core seems to work. Is the symbol core special?
11:01Chousukecore should work just fine
11:02Chousukemany libraries use similar naming
11:02DeusExPikachuhmmm must be something else in my code, nm
11:13CalJuniorI would like to create a subvector from an existing vector on multiple non-contiguous indices like so: (nth [10 12 13 14 15] '(1 3)) and return (12 14)
11:13jcromartieoi vey... what's a good way to find EOF-while-reading errors?
11:13jcromartieor rather the source of them
11:15jcromartieEmacs indentation!
11:15jcromartiehuzzah!
11:15CalJuniorI would like to create a subvector from an existing vector on multiple non-contiguous indices like so: (nth [10 12 13 14 15] '(1 3)) and return (12 14) but I get an exception.
11:16stuartsierraclojure-contrib master branch is now converted to Maven.
11:16chouserCalJunior: try 'map' instead of 'nth'
11:16jcromartieCalJunior: why do you think nth takes a list of indexes?
11:17CalJuniormap, thanks
11:17stuartsierraI think what you want is (map #(get the-vector %) [10 12 13 14 15)
11:17CalJuniorjcromartie: I just did.
11:17chouserstuartsierra: vectors are fns
11:17chouser:-)
11:17chouser,(map [10 12 13 14 15] '(1 3))
11:17stuartsierrayeah
11:17clojurebot(12 14)
11:18stuartsierraoh, yeah
11:18stuartsierrathat looks funny, but it works
11:18CalJuniorclojure: if it's not simple, you're not doing it right :-)
11:19chouserseriously. That's deliciously close to true.
11:20DeusExPikachuhmmm, I don't think, in swank-clojure.jar, namespace-to-path accounts for proper the possibility of needing to translate from underscore to hyphen when going from pathname to namespace
11:21dabdis clojure-contrib master in sync with clojure 1.1.0?
11:21DeusExPikachucause I'm getting a "no namespace: foo_bar.core found", for the ns foo-bar.core defined in file /foo_bar/core.clj
11:26stuartsierradabd: no, it's in sync with Clojure master
11:26stuartsierradabd: there are 1.0.x and 1.1.x branches of contrib that map to corresponding versions of Clojure
11:29dabdis it recommended to use clojure + clojure-contrib 1.1.0 or clojure + clojure-contrib master?
11:29DeusExPikachuto be more precise, the call to ns-name in namespace-to-path is being fed foo_bar.core, which doesn't exists, I believe this is traced to the (.getClassName frame) in source-location-for-frame
11:30Chousukehmmh
11:31stuartsierradabd: depends on what you want. If you want a stable target, use 1.1.0. If you want to play with deftype/defprotocol, use master.
11:33dabdstuartsierra: thx
11:34angermandoes clojrue support an easy way to merge two functions?
11:34stuartsierramerge how?
11:34angermane.g. we have empty? now I want to extend empty? for another type.
11:34angermanbasically a multifn
11:35stuartsierraangerman: that is not possible right now, but will be possible with the addition of protocols
11:35Chousukeyou can redefine functions though, but doing that for core fns is rather evil :P
11:35angermanstuartsierra: ok. For now it would work if every function was a multifn dispatching on input type
11:35stuartsierraangerman: yes, but they aren't :)
11:36angermanChousuke: yep. like using clojure core, except empty or renaming empty and wrapping it.
11:36angermanok. so protocols are the way to get that
11:36angermangood to know
11:36Chousukebut (let [old-empty empty?] (alter-var-root #'empty? (constantly (fn [...] (...))))
11:36stuartsierralook at my Tuple examples for how that can be done with deftype/defprotocol
11:37jcromartieyay for atomic file saves
11:37angermanChousuke: ohh, i've never dug that deep down.
11:37Chousukevery evil, but possible :P
11:37jcromartieI want to be able to ^C my server
11:37angermanstuartsierra: thanks.
11:37jcromartieand not lose data
11:37angermanjcromartie: doesn't ^C just send a signal to the process?
11:37DeusExPikachufor swank-clojure, is inspecting and evaling in the debugger not supported?
11:38jcromartieyeah but if it's in the middle of something like duck-streams/spit it will leave me with a junk file
11:38Chousukejcromartie: you can't do file writes atomically but renames are possible as far as I know.
11:38jcromartieI'm saving with a watch on a ref instead of using a database
11:38jcromartieyes
11:38jcromartiethat's what I mean
11:38angermanjcromartie: hmm. can you not catch the ^C signal, do cleanup and exit?
11:38jcromartieI dunno
11:39jcromartiehaven't tried it
11:39jcromartieyeah it sends a signal
11:39jcromartiebut this is a compojure app
11:39jcromartienot sure how to wire that up
11:40stuartsierrasignal-handling is OS-specific, you need classes in sun.* to do it
11:41angermanand then it's probably though the application server layer that's killing the servelts
11:47replacaangerman: ^c is sigint
11:48angermanreplaca: ohh. thanks. I hope it sticks this time :D
11:48replacasigterm is what kill sends by default. There's no keyboard version of it
11:48angermanand sigkill is -9?
11:49replacayeah,
11:50replacabut you can't catch it
11:51jcromartieah, yikes, apparently duck-streams can't write Date objects?
11:51jcromartiethat's kind of critical
11:52angerman(.toString date-obj)?
11:52angermanI'm sure it can write that one
11:52replacajcromartie: I think that's kind of orthogonal to duck-streams
11:52replacajcromartie: duck-streams just gives you readers and writers
11:53jcromartieso I need to transform every Date tucked into every nook and cranny of my data and also somehow catch them on the way back in
11:53jcromartiesounds like fun
11:53replacajcromartie: That's generally true of Java objects in Clojure :-(
11:54hiredmanjcromartie: what do you mean duck-streams can't write Date objects?
11:54jcromartieso there's no Clojure-y way to use dates, I take it?
11:54jcromartieI mean it writes an unreadable form
11:54replacawe really needs to have some sort of hybrid serializer
11:54hiredmanI don't really use ds but I believe it just provides a stream
11:54hiredmanit's up to you to do the reading and writing
11:54jcromartieyeah
11:54jcromartieI guess I could store timestamps
11:55replacajcromartie: that's right - dates are just java objects to clojure
11:55chouserYou can add a readable print method for Dates if you want.
11:55hiredmanobjects are printed using the print-method multimethod so you can add your own dispatch to that
11:55jcromartieah
11:57replacachouser, hiredman: good call
11:58angermanjcromartie: did you look at the astraction crafting from Full Disclojure?
11:58jcromartieno
11:59jcromartieI'm reading/writing dates now though
11:59jcromartie(defmethod print-method java.util.Date ...)
12:00angermanjcromartie: well idea behind the episode is representing Date classes as Long values.
12:00jcromartieah
12:01angerman-> http://vimeo.com/8801325
12:04stuartsierraclojure-contrib 1.0.0 and 1.1.0 final releases are up! ZIPS at http://code.google.com/p/clojure-contrib/ and Maven artifacts at http://build.clojure.org/releases
12:05chouseryay!
12:05chouserstuartsierra: thank you so much for doing that.
12:05technomancythanks stuart!
12:06stuartsierraYou're welcome, all.
12:06LauJensentechnomancy - How do I get swank-clojure to work with latest pulls of c & c-contrib ?
12:08jcromartiebrilliant stuff angerman thanks
12:09angermanjcromartie: it's one of the really worthwhile screencasts, doing a great tribute to clojure
12:09jcromartiemuch better than my printing a Date constructor :P
12:12angermanyou just hav to print (date <long-date-format>) though I think
12:12angermanI'm still not sure it's sufficient if you need TZ info
12:12hiredman#=(date long)
12:13hiredman#= is read time evaluation
12:14angermanthat was supposed to be a :) smily
12:21esjangerman: yeah, right this very moment Sean is working on putting TZ content into this library within Incanter.
12:22angermanjava -> file -> libsvm -> file -> java -> ... seems just not "perfect"
12:25StartsWithK(defn str-plus [(-> (Integer/parseInt a)) (-> (Integer/parseInt b))] (+ a b)) in the 1.2 this will work? why?
12:26Chousukeit will?
12:26StartsWithK.. without a wrong place for right paren
12:26StartsWithKi just looked at destructuring -> and ->> patch
12:26Chousukeah, right, that.
12:26StartsWithKand it will apply to fn to
12:26Chousukewell, it's just an extension to the existing destructuring syntax
12:26StartsWithKhmm
12:26StartsWithKwhy?
12:26clojurebothttp://clojure.org/rationale
12:27ChousukeStartsWithK: probably because it's sometimes useful to apply functions to things.
12:28StartsWithK(let [(-> str a) 1]) vs (let [a (str 1)]), the second one is even shorter
12:28StartsWithKChousuke, in function arguments? don't we have a better place for that
12:28StartsWithKlike function body..
12:29chouserStartsWithK: that patch is not approved
12:29Chousukechouser: it is in approved backlog though.
12:29StartsWithKyet :)
12:30StartsWithKi can't write any expression that would be shorter with that extension, maybe i'm not trying that hard
12:30StartsWithKis extra 'let' that a big of the deal for people?
12:32Chousukeprobably not.
12:32StartsWithK(defn str-plus [a b] (+ (Integer/parseInt a) (+ (Integer/parseInt b)))) is shorter, (let [a (str 1)]) too
12:32chouserStartsWithK: it gets more interesting with more deeply-nested destructuring
12:32StartsWithKchouser, example?
12:33StartsWithK(defn str-plus-in-map [{(-> (Integer/parseInt) a) :num} {(-> (Integer/parseInt) b) :num}] (+ a b))
12:34StartsWithK(defn str-plust-in-map [{a :num} {b :num}] (+ (Integer/parsInt a) (Integer/parseInt b)))
12:34StartsWithKstill shorter, and more readable
12:54jcromartieman, that abstraction grafting video was great
14:01dsophmm I'm new to clojure and lisp at all and I have a question. I try to do a (gen-class) so I create a (ns) and use an import but in the defn the types imported cannot be resolved
14:04hiredmaneh?
14:05dsopso I'm not sure how to import a class from a java lib like foo.bar.Baz and then use just the reference Baz in the further code
14:06technomancycemerick: I usually do sound effects whenever I type them
14:07hiredmandsop: using ns or just using import?
14:07cemerickdsop: (import 'foo.bar.Baz) at the repl, or (:import foo.bar.Baz) in ns
14:07dsopusing ns
14:07hiredman(:import (foo.bar Baz))
14:08hiredmanI mean, cemerick's will work, but java being java you will want to import more classes from the package
14:08cemerickI'm guessing it's one step at at time in the early days :-)
14:08dsophmm probably. In that case I try to access an enum from a class
14:09dsop:)
14:09cemerickthat'd be Classname/ENUM_VALUE
14:10dsoparg
14:15joshua-choiIs there a standard sequence function so that (mystery [4 5 6] [2 3 4]) -> ((4 2) (5 3) (6 4))?
14:15chouser,(map list [4 5 6] [2 3 4])
14:15clojurebot((4 2) (5 3) (6 4))
14:15joshua-choiAh, thanks
14:16cemerickdsop: no worries :-)
14:18dsopcemerick: so it should be http://pastebin.com/m7717b71e
14:19cemerickdsop: type is an inner enum?
14:19cemerickCentrality.Type, that is?
14:19dsopyes
14:20cemerickIf so, it needs to be specified as Centrality$Type in the import (java inner classes are delineated by $ in the JVM -- javac just plasters over it for Java)
14:20cemerickOtherwise, that looks OK (though I certainly don't know anything about the APIs you're working with)
14:21dsopcemerick: works! thanks a lot
14:21dsopprobably not the simples thing to start using closure with :)
14:21cemerickdsop: no problem :-D
14:21cemerickyeah, gen-class is definitely near the deeper end of the pool
14:50cemerickstuartsierra: it might be worth parameterizing the clojure version so that people can bounce back and forth using system properties if they're so inclined, and so that folks don't have to open a "scary" xml file to use a particular version *shrug*
14:51cemerickis there a reverse-map somewhere, or is (->> m (map reverse) (map vec) (into {})) the best there is?
14:52stuartsierracemerick: yes, that's not a bad idea
14:52stuartsierracemerick: clojure.set/map-invert
14:52cemerickI use clojure.version as the property, FWIW
14:53cemerickstuartsierra: thanks. Odd that it's in set.
14:55stuartsierracemerick: Is there a simple way to allow people to "inject" their own clojure.jar as they would with the Ant build?
14:57the-kennyThere's map-invert? Cool!
14:57the-kenny,(use 'clojure.set)
14:57clojurebotnil
14:57the-kenny(doc map-invert)
14:57clojurebot"([m]); Returns the map with the vals mapped to the keys."
14:57stuartsierraI think you mean zipmap
14:57cemerickstuartsierra: I don't think so. You *might* be able to wire up a target that deployed a provided file locally, and then set the appropriate clojure.version to something unique.
14:58the-kennystuartsierra: Uh, yeah. Sorry
14:58stuartsierracemerick: nah, too complicated
14:58cemerickyeah, I agree
14:59stuartsierraok, committed & pushed
14:59cemerickAnt is like a band-aid: one motion, right off!
15:01LauJensenclojurebot: ant is like a band-aid: one motion, right off! <cemerick>
15:01clojurebotAlles klar
15:01cemerickoh, good
15:01cemerickThat's gonna end up being my epitaph now. :-P
15:05stuartsierraShould the clojure-contrib version string have a branch name in it, like Clojure?
15:07chouserwhat's the alternative?
15:07chouseralpha/beta?
15:07the-kennyDas teta
15:07the-kennys/Das //
15:08stuartsierraRight now it's just "1.2.0-SNAPSHOT"
15:10cemerickstuartsierra: I don't think the branch names in versions have panned out very well. e.g. when new got merged into master, 1.1.0-master-SNAPSHOTs were being churned out after 1.1.0 was released, containing stuff from the new branch
15:10stuartsierrayeah, that was messy
15:11stuartsierraThat was because no one updated the version numbers, though.
15:11cemerickinsofar as what is on a branch can change, it doesn't seem like that should leak into the version
15:11stuartsierraThe only advantage was the ability to create snapshots of different branches.
15:12cemerickyeah, but still; really, 1.1.0-new-SNAPSHOT probably should have been 1.2.0-SNAPSHOT from the beginning.
15:12technomancybranch names are valuable if there's a branch of clojure that breaks AOT-compatibility with master of the same snapshot version number
15:12technomancyif that happens again we should think about it
15:12technomancybut putting "master" in the version number seems superfluous; it should be considered the default
15:12cemericktechnomancy: my point being, if that's about to happen, then the version numbers should diverge.
15:13technomancywhy not put the branch in the version only for non-masters?
15:13cemerickthat's a thought, as long as branch names never get reused
15:14technomancyif they get re-used within a single snapshot version then we're in trouble. =)
15:15cemericksort of the opposite of what happened with 1.1.0-master-snapshot, but I'd say it's possible :-)
15:17alexykI'm loading an array of triples [x y val], to be added to a graph {x {y val}}. Doing it via (assoc-in graph [x y] v) is painfully slow. How should I structure the transient to speed it up?
15:17hiredmanvector
15:18hiredman(as in, "that is a vectory, not an array")
15:21alexykvector, right. Should I have transient map of transient maps, or transient of regulars, or what? I have about 3 million top-level keys, with about 30 inner keys.
15:24dsophas someone tried yet to put clojure code into a jar file and load it dynamically to runtime?
15:24dsopI mean load the compile classes
15:25dsopit seems that I cannot convince the clojure class loader to search for the .clj file in the actual jar . the loader seems to try to load it with the system class loader
15:25alexykwhat I think is seriously lacking is a transient multi-level map with a clear way to update a key on a path. So far it's not at all clear how to do that.
15:25cemerickdsop: if you have .clj files in a jar, you need to load them via RT.load -- at that point, they'll be compiled
15:25cemerickdsop: the jar needs to be on your classpath, regardless
15:25chouseralexyk: I think rhickey has a plan for that, currently called 'cells'
15:26alexykchouser: super!
15:26cemerickut oh, gonna tick off the constraints folks :-P
15:26alexykI've killed two JVMs today with Clojure running out of swap with 64 GB RAM. Hope cells show up before my deadline of 2/2! :)
15:26dsopcemerick: hmm this would make the classloader code depend on clojure. with scala it works that you put the library.jar in your classpath and you then can load other scala classes dynamically
15:26cemerickI'd say it's time for binding* (serial-binding)
15:26chouserprobably needs a better name
15:26technomancyoh, that's what cells are about.
15:27chouserwell, that's one related feature
15:27dsopcemerick: so without the RT.load trick there is no way for me to load clojure compiled class files with let's say URLClassLoader
15:27hiredmanyou can drive the asm library in clojure to generate a classfile that has no dependency on clojure
15:27cemerickdsop: oh, you've AOT-compiled to classfiles already?
15:28dsopaehm
15:28cemerickif you've got a (:gen-class) form in your ns, and you've compiled that file so that .class files are emitted, then you can put those classfiles in a jar and access them using the name of the originating namespace (by default)
15:29hiredmancemerick: I imagine he is running (compile 'some.namespace), and then trying to goes his merry way using the generated class
15:29dsophiredman: what other way then compile should i use?
15:29hiredmanthe problems with this are many, the most obvious being the class and the namespace have the same name
15:29cemerickhiredman: really? Scala doesn't do anything of the sort.
15:30alexykwhat I'm pondering now is inserting into ConcurrentHashMap; but then I'd have to convert it to a {x {y val}} graph -- is there a way?
15:30dsopI use (:gen-class), (compile) and put the stuff into a jar
15:30hiredmancemerick: huh?
15:30hiredmandsop: best to be more specific about your process
15:30hiredmanbut gen-class is not for dynamic code generation
15:30cemerickdsop: good, so if you then add that jar to the classpath of whatever app you want to run, you can access those generated classfiles as if javac had produced them.
15:32dsophiredman: I have a outdegree.clj with a gen-class. I then use (compile 'outdegree) to compile .class files from it, I put them into a jar file and try to load the outdegree.class using javas URLClassLoader which should resolve references to other .class files i nthe same jar
15:32hiredmandsop: the first problem you need to addess is your namespace
15:32hiredman~compile
15:32clojurebotthe unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation
15:33dsophiredman: now in this case it aborts with FileNoutFound Cannot locate outdegree_init.class or outdegree.clj on classpath
15:33hiredmandsop: read from clojurebot
15:34hiredmanare you sure you need to gen-class?
15:34hiredmanif you don't, then don't
15:34dsophiredman: yes I already did that
15:34hiredmandsop: nah, you obviously didn't
15:34dsophiredman: yes, because I the plugin mechanism that uses the URLClassLoader doesn't know about clojure
15:35hiredmanoh
15:35hiredmansorry
15:35hiredmanwrong one
15:35hiredman~namespace
15:35clojurebotexcusez-moi
15:35hiredman~namespaces
15:35clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
15:35hiredmanthats the one
15:36dsophiredman: I use the ns name net.experimentalworks.clojure.outdegree. my file compiles to net/experimentalowrks/clojure/outdegree.class (and all other auto classes, etc) I then put this net/ dir in the jar
15:36hiredmanok
15:37dsopjava loads it, it then calls colojure.lang.RT to complete the process and RT fails as it searches the standard class loader
15:37dsopif I don't load it dynamically but put the jar into the classpath during startup it works
15:37hiredmanagain
15:37hiredmanplease be clear about what you are doing
15:38hiredmanyou are running launching the clojure repl then running compile, then trying to load the class file from a jar using a urlclassloader, all from the same repl session?
15:39hiredmandsop: sure, as I said earlier, gen-class is not for dynamic code generation
15:39dsophiredman: no I have a outdegree.clj with a gen-class in it. I run compile from the REPL. then I close the repl session put the generated class files into a jar file (http://pastebin.com/d2eb94aa) Then I load the .jar file from a java application using URLClassLoader.
15:40hiredmandsop: ah
15:40dsopand then I try to instantiate net.experimentalworks.clojure.outdegree
15:40cemerickoh
15:40cemerickdsop: you need clojure on the classpath as well
15:40hiredmanand you have clojure.jar on the classpath for the java app?
15:40dsopeverything works unti lthe actual initialization. Also the Class<?> file is returned and loaded correctly
15:40dsopyes I have clojure in the classpath
15:41hiredmandsop: where is the exception?
15:41hiredmanlike, did you pastebin it somewhere?
15:41dsopone moment
15:43StartsWithK,(-> 1)
15:43clojurebot1
15:43StartsWithK,(->> 1)
15:43clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$--GT--GT-
15:44StartsWithKshouldn't (->> 1) also return 1
15:44dsophiredman: cemerick http://pastebin.com/d242dbc4f
15:44hiredmandsop: looks like a classloader issue
15:45dsophiredman: for me it looks that clojure always searches for the acutal _files_ in the system classloader
15:45dsopand the system class loader doesn't know about the jar at all
15:45hiredmandsop: well, presumably you have clojure.jar loaded with the system loader
15:45dsopyes for sure, otherwise .RT wouldn't be found
15:46hiredmanI think the issue is clojure.jar and your jar have different classloader roots
15:46hiredmanso they can't interact with each other
15:46dsopyes for sure they have
15:46dsopthe clojure.jar is loaded by the system loader
15:46dsopbut that brings me to an idea
15:46cemerickhiredman: but net.experimentalworks.clojure.outdegree is being loaded just fine, just not __init -- seems like all the generated classfiles aren't making it into the jar
15:46dsophiredman: thanks so far for the help
15:46cemerickdsop: ^^ meant for you
15:47hiredmancemerick: yeah, the init stuff fails to load because it tries to talk to clojure
15:47dsopcemerick: yes but the __init file is in the jar
15:47hiredmanand it's classloader doesn't know clojure
15:47hiredmanor something
15:47dsopit's because the RT earches for the __init file
15:47dsophiredman: yes I guess so too, thanks for the help
15:48cemerickhiredman: if that were true, then it should fail in net.experimentalworks.clojure.outdegree.<clinit> trying to get access to Var/RT
15:48dsopI proberbly do nasty stuff here :)
15:48hiredmancemerick: right
15:48hiredmannew theory
15:48dsopcemerick: the point is the urlclasloader can access the system class loader so it can load RT
15:48hiredmanit's the check to see if the class file or the clj file is newer
15:48dsopbut the RT doesn't know the urlclassloader
15:48cemerickdsop: you're running in Jetty, so you're a long way away from the system classloader
15:49dsopcemerick: true :)
15:49cemerickdsop: how are you providing your classpath to jetty?
15:49dsopcemerick: default classpaths in the WEB-INF/ directory, which is handled by gwt stuff
15:49hiredmanRT's load stuff checks to see if the *.clj or the *.class is newer and loads the newest one
15:50hiredmanso that might be the actual point of failure
15:50hiredmanwhich is more promising
15:50cemerickdsop: and you have clojure.jar and your jar in WEB-INF/lib?
15:50hiredman(easier to deal with. maybe.)
15:51dsopcemerick: no I have clojure.jar in my WEB-INF/lib, but my jar is loaded dynamically from somewhere. It shouldn't be in the systems/jetty classpath
15:51cemerickwell, there we go
15:51cemerickdsop: why?
15:52dsopcemerick: because you should put jars somewhere, reload the servlet and be able to load new jars without touching the .war file
15:52dsopcemerick: somekind of 'plugin system'
15:52dsopthey basically just contain algorithms that should be loaded to runtime
15:52cemerickdsop: what is this "plugin system"?
15:53dsopcemerick: it's bascially just searching for jars in a directory and initializing a given class out of it, during runtime
15:53cemerickdsop: this is something you wrote?
15:53hiredmanhttp://github.com/hiredman/clojure/blob/master/src/jvm/clojure/lang/RT.java#L402 <-- this is the exception you are seeing
15:53hiredmaner
15:54hiredmanhttp://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/RT.java#L409 <-- this one
15:55dsopcemerick: yes.
15:55dsophiredman: yes this is it
15:55dsopcemerick: I'm not saying it's perfec,t but it works for java and scala stuff so far
15:56cemerickdsop: then, in general, you've got a bug or design flaw in how you're integrating with your parent (jetty's) classloader
16:20defn,(:macro (meta #'and))
16:20clojurebottrue
16:21dnolen*** You have joined channel #clojure [15:55]
16:21dnolen*** Topic for #clojure: Clojure, the Lisp that makes the JVM dynamic. See
16:21dnolen http://clojure.org or video at http://clojure.blip.tv .
16:21dnolen*** #clojure: topic set by jcowan, 17:18:57 2008/03/07
16:21dnolen*** Users on #clojure: dnolen rfgpfeiffer fedito dnolen-rec dabd` mccraig
16:21dnolen mudphone mikehinchey LeNsTR slyrus grosours jcromartie dysinger
16:21dnolen perspectival ynniv jkkramer krumholt__ ior3k Raz_ dsop heow choas somnium
16:21dnolen mrsolo hipertracker Hali_303 caljunior Kyrus duncanm opqdonut boyd replaca
16:21defnuh oh'
16:21dnolen Ash rdd dnm_ jasapp_ spariev_ the-kenny Guest19765 Hun ghotli ntoll
16:21cemerickah crap, not this again
16:21dnolen lghtng_away _mst kjalarr hiredman mariorz gregh rsynnott Leonidas shachaf
16:21dnolen erg morty rys aking rowth hobbsc lisppaste8
16:21defnthis could be very bad
16:21dnolen*** Users on #clojure: headlessClown cpfr AWizzArd murbank mrSpec fmu jjames
16:21cemerickdnolen: dude, you've been owned
16:21dnolen shmichael jpulakka tomaw__ webben hoeck durka42 Strika rberger cburroughs
16:21dnolen wtetzner Raynes mtm Modius corruptmemory lopex walters probablyCorey hone_
16:21dnolen Knekk_ seangrove jbomo hipertracker-off danlarkin Chousuke therealadam
16:21dnolen morphling DeusExPikachu mabes dbx triddell romanb LauJensen StartsWithK
16:21jcromartiewhat the heck is that
16:21dnolen enebo stuartsierra wilig wlr Bjering_ froog_ st_ onion_ liebke ivan
16:21defnmethinks someone doesn't know how to use emacs
16:21jcromartieI don't like it
16:21dnolen ivan_chernetsky fogus G0SUB
16:21dnolen*** Users on #clojure: jamie_alm jweiss jfkw_ cemerick blubber-- shrughes
16:21dnolen geramuk l_a_m technomancy|away cgrand OlegYch|h__ fractalis dalkvist defn
16:21dnolen janm zakwilson scottj ndimiduk Licenser pavelludiq lhitchon mrmargolis pdk
16:21dnolen tomoj npm hyp3rvigi1ant andreaja polypus eno sattvik esj datka hdurer
16:21hiredmanno ops here (ever) either
16:21dnolen xandrews Holcxjo KarlThePagan2 Fingerzam Luyt Draggor redinger ttmrichter
16:22dnolen dmiller2718 fivebats chouser j0ni arbscht ambroff jonafan smyge thickey
16:22dnolen angerman jedediah bobo_ skeptomai|away
16:22dnolen*** Users on #clojure: scode frodwith jarpiain rotty turbo24prg lenbust
16:22dnolen syntaxman strlen dthomas peddie broquaint ocher noidi Apage43 dmiles_afk
16:22jcromartiewho can kick him?
16:22dnolen bitbckt metric cp2 shr3kst3r drewr nareshov marten shawn_ nuba Aisling
16:22jonafanwat
16:22jcromartieanybody?
16:22hiredmanno one
16:22dnolen raek yason danm__ Drakeson clojurebot piccolino abrooks brixen srcerer
16:22jcromartiefun
16:22dnolen ts00000 gbj`` albino hchbaw bhall unfo- cypher23 haptiK TheBusby felipe`
16:22dnolen clows gravity mtd joewilliams codemonkeyx mfoemmel _alex _BLINDWHITECRABS
16:22technomancythere's always /ignore, fellas
16:22defnsigh
16:22dnolen fgtech Intensity leafw s450r1 eivindu
16:22dnolen*** Users on #clojure: mikem nullman` sjbach @ChanServ
16:22nubawth?
16:22dnolen<dsop> hiredman: yes this is it
16:22dnolen*** #clojure modes: +tncR
16:22dnolen*** #clojure was created on Tuesday 2007/12/11 17:04:26
16:22defnhe's almost done
16:22dnolen<dsop> cemerick: I'm not saying it's perfec,t but it works for java and scala
16:22dnolen stuff so far
16:22dnolen<cemerick> dsop: then, in general, you've got a bug or design flaw in how
16:22dnolen you're integrating with your parent (jetty's) classloader [15:56]
16:22defnnevermind
16:22dnolen*** seangrove (n=user@c-67-188-3-10.hsd1.ca.comcast.net) has quit: Remote
16:22dnolen closed the connection
16:22dnolen*** seangrove (n=user@c-67-188-3-10.hsd1.ca.comcast.net) has joined channel
16:23Draggorcopy paste fail?
16:23dnolen #clojure [15:57]
16:23dnolen*** kotarak (n=mb@ip-81-210-163-176.unitymediagroup.de) has joined channel
16:23dnolen #clojure [15:58]
16:23dnolen*** technomancy (n=user@71-23-19-98.war.clearwire-wmx.net) has joined channel
16:23dnolen #clojure
16:23dnolen*** dabd` (n=user@wifi.ist.utl.pt) has quit: Read error: 113 (No route to
16:23dnolen host) [16:02]
16:23dnolen*** nathanmarz (n=marz@204.14.159.167) has joined channel #clojure [16:03]
16:23dnolen*** ikaros (n=ikaros@f051195105.adsl.alicedsl.de) has joined channel #clojure
16:23defndnolen: you're ignored. sorry dude, but if you accidentally copy/pasted, you need to just quit your client so we don't have to read this garbage
16:23dnolen [16:04]
16:23dnolen*** _bob (n=bgr@dc5146e16c.adsl.wanadoo.nl) has joined channel #clojure [16:06]
16:23dnolen
16:23defnanywho -- what's up all?
16:23datkaYou can only sit back in abject horror as you're powerless to stop yourself
16:23LeNsTRdnolen: u'r idiot -_-
16:23defndatka: lol
16:23ivanno, you can close the connection
16:24somniumM-x butterfly gone horribly wrong?
16:24kotarakLeNsTR: watch your language.
16:24LeNsTRsorry
16:24defnwtf is butterfly?
16:24Draggorkill -9 is a beutiful thing
16:24defnI just see "Amazing physics going on..."
16:25the-kennyM-x butterfly is a parody to xkcd :)
16:25kotarakdefn: http://xkcd.com/378/
16:25datkaThat comic always bothered me because you wouldn't have a shortcut like that
16:26DraggorI should give vimclojure a shot again, unless there's something better
16:26kotarakDraggor: what is the problem with vimclojure?
16:26defnkotarak: :D
16:26defnDraggor: it's called Emacs
16:26defn;)
16:26Draggordefn: I like my pinky finger too much to use emacs ;)
16:27kotarakDraggor: take your chance to tell the author how to imrpove it.
16:27defnDraggor: just make caps lock your control key and use your ring, sweet heart :)
16:27Draggorkotarak: Last time I attempted I just never got it working, though at the time my install was.. borked, so I should try again.
16:27Draggordefn: Ultimately, I am way too attached to my different modes (visual/command/edit/etc)
16:28kotarakDraggor: let me know, when you have a specific problem.
16:28Draggordefn: And no mod in emacs ever worked to my satisfaction
16:28defnnod -- it's okay, i just recommend emacs to people using clojure
16:28defnparedit + clojure mode + swank === win
16:28Draggordefn: I used it when I was at a lisp programming job for about a year, so I got ot know emacs well
16:29defnokay before this gets any further -- let's stop the editor wars
16:29defnive had this discussion in here like 30-40 times i think so far heh
16:29StartsWithKkotarak, ant build.xml plz :)
16:34defni do not "get" enlive at all
16:35kotarakStartsWithK: hmmm... not sure
16:36cemerickdefn: let me know if you have any Q's. I'm no expert, but I'm enjoying enlive a *lot*.
16:36defncemerick: ill have a couple in a minute here, im just getting the skeleton of this project to stand up
16:37Draggorkotarak: if I want to use compojure, do I swap the clojure.jar with the compojure.jar?
16:37defnand then i have a question im sure you can help me with that has been baffling me :\
16:37jcromartiemmmm enlive
16:37jcromartieI'm using compojure too
16:37cemerickyeah, I was going to say...
16:37kotarakDraggor: dunno. Does compojure include clojure? Otherwise you need both.
16:37cemerickdefn: there's a #compojure channel over there ---->
16:38cemerickno, compojure is just another clojure lib
16:39Draggorenlive looks purdy
16:39defni dont understand how to get from tagsoup-ified output to actual HTML
16:39kotarakdefn: with deftemplate
16:40defnthat's weird to me -- why do i need a template if i dont want to transform the tagsoup at all
16:40defnim just trying to scrape a website, i dont care to transform it in the slightest
16:40cemerickdefn: then just use html-resource and select
16:41cemerickdefn: have you seen http://wiki.github.com/cgrand/enlive/ ?
16:41kotarakDraggor: what does purdy mean?
16:42jcromartieenlive_html.clj
16:42jcromartieit holds all of the secrets
16:42jcromartiedeftemplate is a very simple macro
16:42jcromartieit's built on the template macro
16:42Draggorkotarak: usefull and the code looks nice (poor internet spelling of pretty)
16:43DraggorI think it's also a southern united states pronunciation of pretty as well.
16:43jcromartieit's a hillbilly/low-class accent
16:43jcromartiedefn: you want emit*
16:46defnjcromartie: emit* gives me the "</" "a" ">" type output
16:47defnshould i just apply str
16:47jcromartieyes
16:47defnahhhh, here we go
16:47defnthanks jcromartie
16:48defnim building a scraper for the #clojure html irc logs
16:48jcromartiecan you get the raw logs?
16:48jcromartiebecause that would be much easier
16:48defnyou're telling me :)
16:49defni dont believe there are raw logs but maybe...
16:50defnwhat i was really interested in is making a sort of extension of contrib.repl-utils
16:50hiredmanmy #clojure.log is 49 megs, but the formating is atrocious
16:50defnthat would let you peek at mentions in irc of keywords etc.
16:51hiredmanit changes through out the file to, as I switch irssi themes
16:51defnnod
16:51defnmy logs are terrible as well
16:51defnand far from complete
16:54defnhow would i removed an <a....> node with enlive
16:55cemerickdefn: transform with [:a] (substitute nil) IIRC
17:01defncemerick: could you give me an example?
17:02defnI see what you're saying but I'm not sure how to write it: (transform page-of-nodes (substitute [:a] nil))
17:02defnsomething like that?
17:02defni get nth not supported on this type
17:03cemerickdefn: I've only ever used transformations in the context of deftemplate, so I'm not clear on the exact fns that you need to use for 'bare' replacement. But, this *might* help http://groups.google.com/group/enlive-clj/browse_frm/thread/b309171ebcc253b5
17:10cgrandcemerick: nil is shorthand for (substitute nil) so you can do [:a] (when-let [url (:url data)] (set-attr :href url)) for example
17:16cgranddefn: (flatmap (transformation [:a] nil) nodes)
17:17defncgrand: cool, exactr
17:17defnexactly what i was looking for
17:17defnthanks
17:18dnolen*** You have joined channel #clojure [15:55]
17:18dnolen*** Topic for #clojure: Clojure, the Lisp that makes the JVM dynamic. See
17:18dnolen http://clojure.org or video at http://clojure.blip.tv .
17:18dnolen*** #clojure: topic set by jcowan, 17:18:57 2008/03/07
17:18dnolen*** Users on #clojure: dnolen rfgpfeiffer fedito dnolen-rec dabd` mccraig
17:18dnolen mudphone mikehinchey LeNsTR slyrus grosours jcromartie dysinger
17:18dnolen perspectival ynniv jkkramer krumholt__ ior3k Raz_ dsop heow choas somnium
17:18dnolen mrsolo hipertracker Hali_303 caljunior Kyrus duncanm opqdonut boyd replaca
17:18dnolen Ash rdd dnm_ jasapp_ spariev_ the-kenny Guest19765 Hun ghotli ntoll
17:18LeNsTRoh
17:18dnolen lghtng_away _mst kjalarr hiredman mariorz gregh rsynnott Leonidas shachaf
17:18dnolen erg morty rys aking rowth hobbsc lisppaste8
17:18dnolen*** Users on #clojure: headlessClown cpfr AWizzArd murbank mrSpec fmu jjames
17:18dnolen shmichael jpulakka tomaw__ webben hoeck durka42 Strika rberger cburroughs
17:18dnolen wtetzner Raynes mtm Modius corruptmemory lopex walters probablyCorey hone_
17:18dnolen Knekk_ seangrove jbomo hipertracker-off danlarkin Chousuke therealadam
17:18dnolen morphling DeusExPikachu mabes dbx triddell romanb LauJensen StartsWithK
17:18dnolen enebo stuartsierra wilig wlr Bjering_ froog_ st_ onion_ liebke ivan
17:18dnolen ivan_chernetsky fogus G0SUB
17:18dnolen*** Users on #clojure: jamie_alm jweiss jfkw_ cemerick blubber-- shrughes
17:18dnolen geramuk l_a_m technomancy|away cgrand OlegYch|h__ fractalis dalkvist defn
17:18dnolen janm zakwilson scottj ndimiduk Licenser pavelludiq lhitchon mrmargolis pdk
17:18dnolen tomoj npm hyp3rvigi1ant andreaja polypus eno sattvik esj datka hdurer
17:18dnolen xandrews Holcxjo KarlThePagan2 Fingerzam Luyt Draggor redinger ttmrichter
17:19dnolen dmiller2718 fivebats chouser j0ni arbscht ambroff jonafan smyge thickey
17:19dnolen angerman jedediah bobo_ skeptomai|away
17:19dnolen*** Users on #clojure: scode frodwith jarpiain rotty turbo24prg lenbust
17:19jonafanFUCK YOU.
17:19dnolen syntaxman strlen dthomas peddie broquaint ocher noidi Apage43 dmiles_afk
17:19dnolen bitbckt metric cp2 shr3kst3r drewr nareshov marten shawn_ nuba Aisling
17:19Draggorand the fail begins again
17:19cpfroh come on
17:19dnolen raek yason danm__ Drakeson clojurebot piccolino abrooks brixen srcerer
17:19dnolen ts00000 gbj`` albino hchbaw bhall unfo- cypher23 haptiK TheBusby felipe`
17:19dnolen clows gravity mtd joewilliams codemonkeyx mfoemmel _alex _BLINDWHITECRABS
17:19LeNsTRneed bot
17:19hipertrackerjonafan: use /ignore dnolen
17:19hiredmanI still have him on ignore
17:19defnsame here
17:19RaynesWhat the hell?
17:19RaynesO_o
17:19hipertrackerfucking bot
17:20chouserplease watch your language, guys.
17:20chouserlikely an honest mistake
17:20hiredmanhe's not a bot
17:20scodeProbably just an accidental cut'n'paste.
17:20Huntwice?
17:22dnolen_wowzers apologies
17:22dnolen_emacs erc foobar
17:22defndnolen_: i will unignore
17:22dnolen_thx
17:24jonafansorry, my circuits overloaded and i dropped an fbomb exception
17:25defndnolen_: just FWIW, if you accidentally do that, just close your client -- on your end it looks like you pasted the whole thing, but on our ends it slowly scrolls one line..waits a second or two, posts the next line, etc.
17:25defnif you just cut your client you'll avoid (some of) the rage
17:26dnolen_defn: yeah, I didn't realize what was going initially, and thought I'd closed the client but hadn't really
17:26defnnod -- no worries
17:27chouserin the end, not as bad as most editor discussions.
17:27kotarak:)
17:27defnlol chouser
17:28the-kennychouser: You're right
17:28chouserif for no other reason than that I have a hard time ignoring editor discussions. :-/
17:48krumholtdid somebody just say "editor discussion"? :)
17:48dnolenfunny enough that whole fiasco was caused by my newb handling of emacs the OS :)
17:50Draggorb'dum tish
17:57zakwilsonSo I need to write a custom smtp server. It's nothing too special; it just needs to have some hooks in to the mail delivery process. Any suggestions for libraries that do most of the work for me?
18:02mabesfor some reason I can't get a request body from compojure: http://gist.github.com/286367 Any ideas on what I am doing wrong?
18:04hiredmandon't you have to do -X PUT for curl?
18:08mabeshiredman: yeah, it looks like the data is coming across as form-params otherwise.. so the problem must be the curl command. I misunderstood the --data flag in the man pages.. Rereading the man page now..
18:23erikpriceHow do I put a call to recur in the tail position if I only want the recursion to happen under certain conditions? Making my (recur) call one of the expressions of an (if) is invalid.
18:23erikprice(Sorry if that message is a repeat; I wasn't registered with the nickserv the first time.)
18:24joshcheekHi, wanting to use Clojure for my AI course, but I can't figure out how to have it evaluate a file, all the instructions I've seen deal with the REPL. Can anyone link me to instructions for setting it up so I can just type "cloj my_file.clj" and have it execute?
18:24dnolenerikprice: making recur a position in if is not necessarily the problem.
18:25erikpriceah. In my case, I'm attempting to call recur in an 'if' at the end of an anonymous function. Is this incorrect usage of recur?
18:25hiredman~dead simple setup
18:25clojurebotsimple setup is http://www.thelastcitadel.com/dirt-simple-clojure
18:25hiredmanthe last line there
18:25hiredmanif you tack the filename on the end of it, it will do what you want
18:25dnolenerikprice: can you paste the code?
18:25joshcheekthank you, hiredman and bot
18:25erikpricesure which pastebin do we use here
18:25hiredmanerikprice: a function can have more that one tail
18:26hiredmaneach branch of an if is a tail
18:26dnolendoesn't matter really I like gist but people here tend to use http://paste.lisp.org/
18:27hiredmanlisppaste8: url?
18:27erikpricehttp://paste.lisp.org/+20GO
18:28hiredmanthat recur is not in the tail position
18:28hiredmanI don't see what you are trying to do
18:29hiredmanat all
18:29erikpricethat is wrong
18:29erikpriceapparently I made a typo.
18:30hiredmanyou have a function, that when called creates a function, and calls that function immediatly, which returns []
18:30hiredmanthat is not going into the issue with recur
18:30erikpriceafter fixing my typo, I no longer get the compiler error about misusing recur - the function compiles. Pardon my boneheadedness.
18:30hiredmaneasier just to do (defn sift [s] [])
18:31erikpriceThis is the fixed version, FWIW: http://paste.lisp.org/+20GO/1
18:31erikprices/fixed version/version without typos/
18:32hiredmanis there a reason you use a fn like that instead of using loop/recur or reduce?
18:32defnI can remove all 'a' tags by doing (flatmap (transformation [:a] nil) my-resource)
18:32defnhow would I remove all <a name...> tags?
18:33defn[:a {:name #"*"}]?
18:33erikprice@hiredman I tried using a reduce but I wasn't clever enough to figure out how to do it that way. I'm working on this exercise: http://fulldisclojure.blogspot.com/2010/01/code-kata-data-sifter.html
18:34erikpriceMy implementation doesn't work yet but at least I'm not getting the compiler error anymore. I'll have to revisit it.
18:34erikpriceThanks again.
18:37hiredmanreduce can do fairly abitrarily complex things
18:37hiredmanar
18:38hiredmanyou would need use a vector and call seq or apply list at the end
18:39hiredman"After that, add the ability to take a vector/array as an input" is kind of ridiculous
18:40hiredmanI mean, it's all seqable, so making it a big deal is dumb
18:40defnanyone know how to refer (in enlive) to <a name=...>? like [:a {:name}] seems like it would work but doesn't
18:40hiredmanreduce will, out of the box, work on all of those types
18:40hiredmandefn: well the reader would barf on that anyway
18:40defnyeah arrindexoutofbounds
18:41hiredmanI would try {:name nil} but I don't know anything about enlive
18:41defngood idea
18:41dnolendefn : http://enlive.cgrand.net/syntax.html
18:41defndnolen: thanks
18:44defnbah i still cannot figure this out -- what is wrong with me today
18:45defn(flatmap (transformation [:a] nil) my-tag-soup) works
18:45defnthe tag-soup data looks like: ({:tag :p, :attrs nil, :content [{:tag :a, :attrs {:name "20:46"}, :content ["20:46"]}...
18:45hiredmansure
18:46hiredmanthat is how clojure.xml represents xml
18:46defnso what is [:a], really? {:tag :a}?
18:46hiredmanwhat?
18:46clojurebotwhat is wrong with you
18:46dnolendefn: are you using enlive or no?
18:46hiredmanclojurebot: thanks!
18:46clojurebotI don't understand.
18:46defndnolen: correct
18:47defnhiredman: earlier I used transformation [:a] -- how does enlive see that? as {:tag :a}, no?
18:47dnolendefn: what is transformation? that's not an enlive function. something of your own?
18:48defnit is an enlive macro
18:48defnnet.cgrand.enlive-html/transformation
18:48defn([] [form] [form & forms])
18:49dnolendefn: are you just trying to select some node are you trying to create some kind of custom transformation for your own use?
18:49defni select some nodes.. I select [:div#main :p]
18:50defnthe nodes it gives me back contain <a hrefs> and <a names>
18:50defni want to remove all of the <a name> stuff
18:51dnolendefn: enlive has 'but'
18:51dnolenit's not a real css selector but it let's exclude nodes
18:52defndnolen: the question still stands though -- how do i represent <a name>
18:54dnolendefn: looking to see if I have an example.
18:56dnolen[:a (attr? :name)]
18:56dnoleni think
18:56dnolenthere's also the enlive ML if that doesn't work
18:57defndnolen: I tried that earlier I think and didn't have any luck, but let me try again
18:58defnyeah it doesn't match
18:58dnolenwhat is the whole selector you are trying to use?
18:59defn(flatmap (transformation [:a (attr? :name)] nil) (select resource [:div#main :p]))
18:59defnthat's the whole thing
19:02dnolendefn: did you try (select resource [:div#main :p (but [:a (attr? name)])]) ?
19:02alexykso, with transient, if I declare one outside a loop as (let [res (transient {})] ... (loop ... (assoc! res x y)), I don't need to reassign (let [res (assoc! res ...)] ...) anymore, assoc! works on the existing, dirty, mutable, in-scope res, right?
19:03dnolendefn: oh I see
19:03dnolendefn: you want all children of those paragraphs just no links with names?
19:04defnyes
19:04dnolenmore like this then, [:div#main :p :* (but [:a (attr? name)])]
19:04defnheh, the first version got me closer
19:04dnolenoops cause of typo
19:04dnolenmore like this then, [:div#main :p :* (but [:a (attr? :name)])]
19:05dnolen:name instead of name
19:05defnyeah i had that
19:05defnhmmmmmm
19:06defnwell this worked, but it's definitely not pretty:
19:07defn(flatmap (transformation [:* (attr? :name)] nil) my-resource)
19:08defnso maybe im picking the wrong selector before?
19:08defndnolen: is :* the same as [:x [:y [:z]]] or just [:x]
19:09defnif i wanted to get to :z would I do [:* :*]
19:15defndnolen: duh -- my fault -- i figured it out, i wanted to do (transformation [:p [:a (attr? :name)]] nil)
19:18alexykthe transient indeed works as described, dirty mutable thing
19:26alexykhmm, freenode is pulsating again
19:32joshcheekHi, trying to install Clojure. I followed http://www.thelastcitadel.com/dirt-simple-clojure but it doesn't seem to work http://grab.by/1Yca
19:41chouserjoshcheek: probably shouldn't have both clojure.jar and clojure-1.1.0.jar
19:42chouserjoshcheek: also might need to: export CLASSPATH
19:43joshcheekchouser: It loads the REPL now, thank you.
19:44chousergreat! you're quite welcome.
19:45joshcheekchouser: I created a file "hello_world.clj" which houses the text '( println "hello world" )' What do I need to do to get Clojure to read this file?
19:46joshcheek(and print "Hello world")
19:46chousertry: java clojure.main -i hello_world.clj
19:47joshcheekchouser: Thank you, I'll quit bugging you now :)
19:48chousernot at all
19:49chouserif you feel very deeply grateful, consider picking up the book: http://joyofclojure.com
19:49chouser:-)
19:51defnchouser: any ETA on the next chapter or two?
19:52chouserdefn: I don't think I can say anything useful except we're working on it
19:54defnchouser: cool cool, just thought id bug you about it :)
19:55chouseroh, I guess I can say that next up you can expect a re-working of the chapters already available, and then after that a chapter on composite types (the collections)
19:59chouserbut all that has at least one round of editing before it goes on the MEAP
19:59joshcheekchouser: I didn't realize manning had a book for clojure, when I search Amazon, the only ones I've seen are the pragprog one (the one I picked up, which did not discuss how to do this), and one by apress, which also isn't out yet. Manning has a high standard of quality (in my experience with Ruby, at least), seems like it should be on that list :/
19:59chouserand I have no sense yet of how long that'll take.
20:00chouserjoshcheek: Manning has two Clojure books on the way. I don't know why they're not on amazon yet.
20:02joshcheekchouser: I'll keep my eye open for it.
20:12alexykI've finally found a way to sweep through my mongo graph very quickly with a transient, just at top level. Alas, it returns only a map with 8 keys, instead of 3 million. Why? Any transient quirks? Here's the fun: http://paste.pocoo.org/show/170077/
20:14alexykit dutifully updates the nested map, non-transient one, for those first 8 keys -- the first in mongo stream. It walks all 37 million triples... And returns a puny res.
20:14hiredmanalexyk: most likely you are bashing a transient in place
20:15hiredmanI seem to recall the number 8 popuping in those cases
20:15alexykhiredman: I do. Should I lay it comfortably on a sofa?
20:15hiredmanno, you should use it just like you do the persitant version
20:15alexykhiredman: you mean I still need to reassign it?
20:15hiredmanit's not assignment!
20:15alexykI've asked above and no one gave a damn
20:15hiredmandid you read the page ontransients?
20:16alexykso -- (let [res (assoc! res ...)] ...) ?
20:16hiredmanhttp://clojure.org/transients
20:16hiredmanread
20:17alexykquick hack fiorst, read second
20:18hiredmanit's not that much to read
20:18alexykseems like adding res to recur will do
20:18alexykdid read it, just one example
20:20alexykhmm
20:20hiredmanpossibly, I don't recall your code, but the key point is: design your algorithm for a persitant structure. if you need speed and it is threadsafe, you stick calls to transient and persistent in key places and suddenly it works for transients
20:25alexykyep
20:25alexykhas to rebind it as persistent... example from TFurl works. Number 8 should go to FAQ or something.
20:30hiredmanno
20:31alexykhiredman: why not? thank you for catching it btw
20:31hiredmanyou don't call persistent until you are all done
20:34alexykwith the principled approach, yes
21:19jasappis there a good introduction to protocols somewhere?
21:26RaynesWhy doesn't (clojure.contrib.repl-utils/source doc) work anymore?
21:27Raynesjasapp: http://www.assembla.com/wiki/show/clojure/Protocols Pretty much covers it.
21:27chouserworks for me. Are you sure you have core.clj on your classpath (not just the compiled .class files)
21:29jasappRaynes: cool, thanks
21:37Rayneschouser: I have the clojure and clojure-contrib jars that leiningen downloaded on my classpath.
21:37Rayneschouser: I can (use ..) repl-utils but I cannot directly call a function from it without (use ..)ing it.
22:01quizmecan somebody give me an example of how to use dochars ?
22:03quizmei'm trying to iterate on each character of a string
22:03alexykI see working code like: (-> cursor .next .toClojure) -- can I omit parens if it's a single name? what's the rule?
22:07Raynes,(doc ->)
22:07clojurebot"([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
22:07RaynesInserts x as the second item in the first form, making a list of it if it is not a list already...
22:11ztellmana number of examples programs in Penumbra work under 1.1.0-new, and don't work under 1.2.0-master
22:12ztellmanI'm willing to believe I was misusing something, but can someone give me any hints as to the differences between the two branches?
22:12ztellmanspecifically that might have to do with clojure.walk or applying metadata to vars?
22:16chouserhuh. 1.2 is mostly backward compatible.
22:16chouserztellman: can you point to a specific example?
22:16ztellmanchouser: yes, but there's a lot of underlying code
22:16chouserhm.
22:16ztellmanthis relates specifically to the translation from s-exprs to GLSL shader code
22:16chousermaybe the stack trace?
22:16ztellmanthe stack trace just says that it can't infer the type of a particular variable
22:17ztellmanin 1.1.0-new, it can; in 1.2.0-master, it can't
22:17ztellmanthe type is attached via metadata, which is why I think maybe that's the culprit
22:18alexykRaynes: indeed, thx
22:20chouserztellman: what's the specific error?
22:21ztellmanchouser: I walk the tree, and the type inferences, and then check to see that every variable has a type
22:21ztellmanin 1.2.0-master, it doesn't, and I throw an exception
22:21ztellmanso it's not an exception from Clojure, if that's what you're angling for
22:40ztellmanok, I've figured out the difference
22:41ztellmanin 1.2.0-master, (meta (second '(a #^b c))) returns nil
22:41ztellmanin 1.1.0-new, it returns {:tag b}
22:42ztellmanis this a bug, or just backwards incompatibility?
22:42dnolenbackward incompat i think
22:42dnolen^ is deprecated
22:42dnolenyou should use meta
22:42ztellmandnolen: ^ to get meta, but to assign meta isn't #^ still the way to go?
22:43dnolenhmm, yeah, dunno about that.
22:43ztellmanis there a new tag reader macro?
22:43ztellmanI know a^int is the way forward, once ^ is no longer a reader macro for meta
22:43ztellmanbut I didn't think we were there yet
22:43chouserztellman: it may be a bug
22:44ztellmanchouser: is there anything else I can do to help with this, or can you take it from here?
22:44chouserztellman: it'd probably be best to post a description to the google group.
22:44ztellmanok, will do
22:44ztellmanthanks
22:45chouserI may have some time to look at it, but Rich can probably glance at it and have it fixed 10 minutes later.
22:45ztellmanjust to be clear, the dev group?
22:45chouserif you're on the dev group, sure. But either is fine.
22:46chouser(meta '#^b c)
22:46chouserlooks like it may be all symbol metadata
22:46chouseroh. wait, nm.
22:51tolstoyWhen you override a method using proxy, is there a way to call the superclass' version of that method? proxy-super is for calling other methods, right?
22:51tolstoySomething like in Java: public void doSomething() { super.doSomething(); myStuff(); }
22:52chouserproxy-super can be used to call the same-named method too
22:52chouserbeware it is not thread-safe.
22:53tolstoyHm. I get some sort of error when I do that. Let me see if I can trap it.
22:53tolstoy(proxy [Something] [] (doSomething [] (proxy-super doSomething) (other-func)))
22:53tolstoythat should work?
22:54chouserI think so
22:55tolstoyYeah, it's what I'd expect from the docs.
22:58tolstoyjava.lang.UnsupportedOperationException
22:58tolstoyHm.
22:58chouserthat usually means the underlying method has no implementation.
22:59defnwhat are all the different types enumerated by metadata?
22:59defnlike (:macro (meta #'and)) => true
22:59defnwhat other types of metadata like :macro exist?
23:00chouserit's an open set. you can add your own!
23:01defnsure i know, i guess i just mean does clojure.core have any others which describe what it is like :macro
23:01chouserI don't know of a complete list, but there aren't actually very many
23:01chouser:arglists, :tag, :doc ...
23:01defnsure, specifically im asking about other identifiers which are very closely related to :macro
23:01defnim not sure what to call that sort of identifier
23:02chouserthe compiler needs that so it knows that a var is actually a macro, so deftype sets it.
23:03defnah-ha!
23:03defn,(doc deftype)
23:03clojurebot"clojure.contrib.types/deftype;[[type-tag constructor-name docstring? attr-map?] [type-tag constructor-name docstring? attr-map? constructor] [type-tag constructor-name docstring? attr-map? constructor deconstructor]]; Define a data type by a type tag (a namespace-qualified keyword) and a symbol naming the constructor function. Optionally, a constructor and a deconstructor function can be given as well, the defaults being
23:04defnwhy is it in contrib if this happens in core?
23:04chouserdeftype was in contrib first, but meant something else.
23:04defnah, for some reason i dont have deftype in my core
23:04defnmaybe i have an old version of clojure?
23:05chouserdefn: deftype is new in the master branch post 1.1
23:05defnchouser: thanks
23:05chouser1.2.0-master-SNAPSHOT
23:05defn many thanks
23:05chousernp
23:05tolstoyAh, I made an interface which looks like a class I usually subclass. So, UnsupportedError.
23:06wlrchouser,ztellman: for me [*clojure-version* (meta (second '(a #^b c)))] => [{:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"} {:tag b}]
23:07chouserwlr: thanks. The change that apparently broke it was 430dd4fa711d0008137d7a82d4b4cd27b6e2d6d1 Tue Jan 19
23:10wlrah. ok.
23:27alexyksomnium: ping
23:28alexykhow do you convert a sorted-map back to a regular one?
23:29defnis there a way to go back?
23:29chouser(into {} a-map)
23:29defnoh duh
23:30alexykok
23:38defn(defn clojure-conversation [container]
23:38defn (doseq [k conversation]
23:38defn (conj container (text k))))
23:38chousernooo
23:38defn:)
23:38chouseris that some kind of sick joke?
23:38chouser:-P
23:38defnunfortunately no
23:39chouseryou can never ignore the return value of 'conj'
23:39defncould you explain what you mean? the implications?
23:39chouserhm, not quite. More like: any code that ignores the return value of 'conj' is useless.
23:39chouserconj doesn't change anything. it creates a new collection instance and returns it
23:40defnoh wait i think i see
23:40defnwhen you conj onto something it return it, but our function will never know about the return from conj
23:40defnyes?
23:40defnreturns*
23:41chouserright, conj does nothing except return a new value. doseq ignores everything returned by the expressions in its body and simply returns nil itself
23:41chouserthus your clojure-conversation will walk through 'conversation', heat up your processor, and return nil
23:41defnso i want a loop/recur
23:42chouser(into container (map text conversation))
23:43chouseror loop/recur if you prefer more lines of code.
23:43hiredmanyou most likely want reduce
23:56defnthanks