#clojure logs

2009-03-26

00:09PuzzlerSo I'm writing a long piece of code, and I'm starting to get annoyed with the need to either forward declare functions, or relocate things in a less readable order. I recall a discussion about a way to alter this behavior. Anyone remember how to do that?
00:38cconstantineIs there anyway to iterate over a map and create a new map... something like (map ...) that returns another map instead of a list
00:41durka42there's a function i wrote :)
00:41cconstantine:P
00:43lisppaste8durka42 pasted "mapmap" at http://paste.lisp.org/display/77618
00:44durka42Clojure=> (mapmap str + {"a" 1 "b" 2} {"c" 0.5 "d" 0.1})
00:44durka42{"bd" 2.1, "ac" 1.5}
00:48durka42Clojure=> (mapmap (comp keyword (partial apply str) #(map name [%1 %2])) + {:a 1 :b 2} {:c 0.5 :d 0.1})
00:48durka42{:bd 2.1, :ac 1.5}
00:48durka42:)
00:50cconstantineI'm gonna have to spend some time understanding that
00:51durka42comp is like nesting the functions ((comp a b c) ...) => (a (b (c ...)))
00:51cconstantineyou didnt use comp
00:51cconstantineoh, your use of it
00:52cconstantinenot that, the actual defn of mapmap
00:52durka42oh you meant the function itself
00:52cconstantineit creates a list of keys, values then zips it... ok
00:52durka42imagining that kf == vf == identity might help trace through it
00:53cconstantineyeah, I got it
01:17nascent16is there a non-lazy form of concat?
01:19nascent16nevermind, the lazy one works fine :)
01:21cconstantinelazy is generally good. if you need to force it to evaluate you can always (last ...) it
01:22nascent16yeah, my question is actually a bit more naive
01:22cconstantineno probs
01:22nascent16,(+ (concat [3, 4] [5,6]))
01:22clojurebotjava.lang.ClassCastException
01:23nascent16i want to use the concatenation of the vectors as the argument to +
01:23cconstantineIs there anyway to give multiple argument list to defmacro like you can to defn? I want to make a macro that accepts one argument (the expression to evaluate), and an optional identifier (if one isn't specified I can just use the string version of the unevaluated expression)
01:23cconstantinewhat do you want that to return?
01:24nascent16(+ 3 4 5 6)
01:24clojurebot*suffusion of yellow*
01:24nascent16,(+ 3 4 5 6)
01:24clojurebot18
01:24cconstantine,(reduce + [3 4] [5 6])
01:24clojurebotjava.lang.ClassCastException: clojure.lang.LazilyPersistentVector cannot be cast to java.lang.Number
01:24cmvkkcconstantine, you can use multiple arities in defmacro just like in defn.
01:25cconstantine,(reduce + (concat [3 4 ] [5 6]))
01:25clojurebot18
01:25nascent16cmvkk: I've had trouble doing that in the past, is it exactly the same?
01:25nascent16nice
01:25nascent16thank cconstantine
01:25nascent16*thanks
01:25cconstantinecmvkk: I had problems with that a few minutes ago
01:25cmvkki think defmacro is really just a defn that also alters some metadata.
01:25cmvkkso it should be exactly the same.
01:25cconstantinenascent16: :)
01:26cconstantinecmvkk: it works like that now
01:26replacadurka42: how is mapmap useful if you don't know a priori the order of keys?
01:26cconstantineso, yeah
01:26cmvkkalso, this is the second time i've seen someone suggest using 'last' to force eval a lazy sequence.
01:26cmvkkisn't that what doall is for?
01:27cmvkkor is it different in some way?
01:27nascent16,(doc doall)
01:27clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time."
01:27cconstantineyup, doall sounds better than last
01:27cmvkkalso
01:27cmvkk,(doc dorun)
01:27clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil."
01:28durka42replaca: i suppose it's useful for the same reason as map -- if you need to do something to each element, like increment or build a database query, or whatever
01:28nascent16so i lied a little bit, my example was too simple and i don't think reduce will work for what i'm actually doing
01:28nascent16i have two lists of agents, and i want to (await) all of them
01:29replacadurka42: but you're examples were combing elements from each map, does this make sense?
01:29cconstantineI used mapmap (well, extracted part of it) to convert a (ref {k (ref v) k2 (ref v2)) structure into a {k v k2 v2} structure
01:29nascent16so i want to append the lists and pass the appended list as the arguments to await
01:29durka42oh, i see what you mean
01:30replacacconstantine: yeah, that usage makes sense to me (though I've just used a lambda with map for that)
01:30durka42i guess it is more useful with maps that come from sorted-map
01:30durka42,(sorted-map :a 1 :b 2)
01:30clojurebot{:a 1, :b 2}
01:30durka42,(= {:a 1 :b 2} (sorted-map :a 1 :b 2))
01:30clojurebottrue
01:31durka42,(= {:b 2 :a 1} (sorted-map :a 1 :b 2))
01:31clojurebottrue
01:31durka42interesting
01:31nascent16maps are sorted by default?
01:31durka42no
01:31cconstantinereplaca: I did a (zipmap (keys the-map) (vals ...)) (wel, something similar
01:31durka42,(sorted? {:a 1 :b 2})
01:31clojurebotfalse
01:31nascent16hm
01:31replacano, I think = just checks to see if they have the same elements
01:31durka42http://clojure.org/data_structures#toc17
01:31cconstantineI noticed unsorted maps produce keys and values with keys/vals in a random order, but the keys and vals were in the same order
01:31durka42that paragraph is kind of dense
01:32replacathat is for map a and map b, is (= (count a) (count b)) and foreach element in a is it also in b
01:32replacayeah, small maps are order by insertion order
01:32replaca,(class {:a 1})
01:32clojurebotclojure.lang.PersistentArrayMap
01:32replacathat's it: array maps!
01:33cconstantineso, should (zip-map (keys the-map) (vals the-map)) produce a map that is equal to the-map?
01:33replacaI think so
01:34durka42,(let [m (apply hash-map (interleave (range 1000) (range 1000 2000)))] (= m (zipmap (keys m) (vals m))))
01:34clojurebottrue
01:35cconstantinefantastic
01:35durka42clojurebot fourths it
01:35cconstantineit's true once so it shall always be true
01:35durka42computer science be damned
01:35cconstantinehehe
01:36cconstantine(defn multiple [x y] (+ x y)) ; works for (multiple 2 2), therefore it's good to go
01:36durka42CS: if we can find a test case that doesn't work, it is incorrect. software engineering: if it passes the unit tests, it's correct!
01:37durka42;)
01:37cconstantine:0
01:37cmvkkgood enough for government work, as they say.
01:37cconstantineindeed
01:38nascent16ok, this argument expansion thing is confusing me
01:38durka42well, now i really am
01:41durka42but i can't leave without the obligatory xkcd... http://xkcd.org/221/
01:43nascent16ah!
01:43nascent16,(doc apply)
01:43clojurebot"([f args* argseq]); Applies fn f to the argument list formed by prepending args to argseq."
01:43nascent16exactly what i'm looking for
02:12hiredman~def c.l.Compiler
02:14hiredman~def load-file
06:30AWizzArdclojurebot: max people
06:31clojurebotmax people is 164
06:55djpowellwhat is the #_ macro for exactly?
06:59Cark,(do (print "hello") #_(print "djpowel"))
06:59clojurebothello
06:59Carkit "comments" the next form
06:59Cark,(do (print "hello") (print "djpowel"))
06:59clojurebothellodjpowel
07:09djpowellHmm, why would you want to do that though?
07:10Carkmaybe you want to disable some functionality in a function you're testing
07:10Carklike logging or whatever
07:19antifuchsor binary search for bugs using a structure editor like paredit. M-<number> M-(, #_ - and you've commented out <number> forms following point. useful sometimes
07:23AWizzArddjpowell: the (comment ...) macro can get you into trouble, because it returns nil. So the #_ is nice, because it removes what follows, as if it never were there. Although I think it first reads the following form, so that should not contain something which the reader doesn't like.
07:23AWizzArd,(+ 1 2 (comment 3))
07:23clojurebotjava.lang.NullPointerException
07:23AWizzArd,(+ 1 2 #_3)
07:23clojurebot3
07:38lepassiveHi, I know python, learned scheme before and I do Haskell, what does Clojure have to offer ?
07:40durka42you might read http://clojure.org/rationale and some of the other things along the sidebar there
07:42antifuchsbtw, the wikispaces guy I talked to said they're working on nicer reload behavior. they plan to update it in a week or so.
07:42Carkantifuchs : great news !
07:42lepassivedurka42, Yes thanks i checked it before asking. just wondering about its benefits for me maybe migrating to coljure in the firm stuff like that
07:43durka42antifuchs: as in faster?
07:43antifuchsdurka42: well, hopefully (:
07:44Carklepassive : with clojure you get comprehensive persistent data structures, agents and STM right of the box
07:45Carkand all the java libraries
07:46lepassiveCark, Hmmmmm okay what about concurrency ? compared to Haskell or Erlang ?
07:46Carkyou have agents which are sort of like but not quite like erlang
07:46Carkand STM for shared state
07:46durka42there is very good support for fast immutable data structures
07:46durka42which help
07:47lepassiveCark, yes I'm familiar with STM from Haskell, the thing is i learned scheme before, and clojure seems not to have that much of docs all over?
07:48Carkyou have the doc and find-doc commands, then the web site has it all
07:49lepassiveOkay Cark thanks for your patience I'll give clojure a shot :)
07:49Carkyou will love it =)
07:50lepassiveCark, I'm sure i'll :)
07:58Carkwhat's the rationale behind the fact that agent send is not queued before the current agent returns ?
08:01rhickeyCark: it's the only way an agent can know the receiver of the action it sends will see its new state - you can use release-pending-sends to force them out prior to end-of-action
08:02Cark,(doc release-pending-sends)
08:02clojurebot"([]); Normally, actions sent directly or indirectly during another action are held until the action completes (changes the agent's state). This function can be used to dispatch any pending sent actions immediately. This has no impact on actions sent during a transaction, which are still held until commit. If no action is occurring, does nothing. Returns the number of actions dispatched."
08:03Carkrhickey : that makes sense, thanks !
08:08Cark~def release-ending-sends
08:08Cark~def clojure.lang.Agent
08:47antifuchsthis is odd. I can't connect to different ports in the same emacs session using swank-clojure
08:47antifuchs(that's with a slime updated from CVS yesterday)
08:48antifuchsconnecting to clojure and an sbcl works fine. just connecting to two clojure instances doesn't. hangs emacs inside slime-accept-process-output.
08:48antifuchsanyone else see that before?
08:49antifuchsI don't see anything conspicuous inside swank-clojure.el; think this might be on the clojure swank side?
08:52antifuchsoops. something is sending something called swank::*load-path* across; this is causing an exception and aborts the repl creation. odd.
08:57antifuchsok, so that was redshank. note to self: try with a clean environment first (-:
08:58AWizzArdantifuchs: you are making good progress :)
08:58antifuchsAWizzArd: yes, I'm pretty amazed myself (:
09:00antifuchsbtw, my na�ve swank plugin to art of illusion is here: http://github.com/antifuchs/aoi-swank-plugin/tree/master - in case anyone feels the urgent need to track my progress ((:
09:16AWizzArdgood
09:22AWizzArdWhen I want to use a debugger to step line by line through clojure code, and I want it to be able to also jump into the code of Clojure itself, should I then point to the src/ folder, or is the clojure-sources.jar enough?
09:24antifuchshmm. what is the preferred way to indent cond clauses?
09:24antifuchsit seems that the condition and consequent should be on the same line, but that sometimes results in too-long lines. any alternatives?
09:27AWizzArdI usually try to make this consistent. An option could be (condition 1)\n(form )\n(condition 2)\(form 2)\...
09:27AWizzArduhm \ ==> \n
09:28ChouserI sometimes indent the consequents one extra level
09:29AWizzArdIn principle it would make sense if the editor/ide would do this automatically.
09:31antifuchsyeah. I initially thought cond would take a [condition consequent] vector for each one
11:21antifuchsst3fan: that's the one that bill clementson's tutorials and scripts use, so it's what I have been using
11:24cconstantine~def defn
11:28cconstantineis tehre anyway to have named optional arguments? if so, how?
11:28st3fanok i got slime working too now
11:28st3fangood good
11:29cconstantineor not even optional.. but named so they can go in any order
11:29st3fanslime integration is not as nice as sblc yet it seems, but it will do the trick
11:29Cark(let [hello (fn [{:keys [name]}] (println "hello, " name))] (hello {:name constantine}))
11:29Cark,(let [hello (fn [{:keys [name]}] (println "hello, " name))] (hello {:name constantine}))
11:29clojurebotjava.lang.Exception: Unable to resolve symbol: constantine in this context
11:29Cark,(let [hello (fn [{:keys [name]}] (println "hello, " name))] (hello {:name "constantine"}))
11:29clojurebothello, constantine
11:30cconstantinefantastic :)
11:30cconstantineso, not really but it can look a lot like it
11:30Carkright
11:31Carkthere is syntax for default value too
11:32cconstantinehow does that look?
11:32Cark,(let [hello (fn [{:keys [name] :or {:name "unknown person"}}] (println "hello, " name))] (hello {:name "constantine"}))
11:32clojurebothello, constantine
11:32Cark,(let [hello (fn [{:keys [name] :or {:name "unknown person"}}] (println "hello, " name))] (hello {}))
11:32clojurebothello, nil
11:32Carkhum
11:33Cark,(let [hello (fn [{name :name :or {name "unknown person"}}] (println "hello, " name))] (hello {}))
11:33clojurebothello, unknown person
11:34cconstantinethat looks kinda ugly in the arg-listing... but nice and clean in the function body and calling
11:35cconstantineand I'm not really sure how I'd make it more clean in the arg-listing
11:35Carkright, you may just define your function like this : (fn [the-map] ... then do the destructuring in a let form
11:35Carkthat's the same syntax
11:35cconstantinethat's all that is right, destructuring binding in the argument list
11:37Carkit's nice to have the destructuring in the arg list, that way slime shows what is required when you use the function
11:37cconstantineyeah
11:38Carkbut yeah it's a bit ugly !
11:38cconstantinei'm not saying it's a bad thing, it's a neat reuse of a feature
13:37fyuryupimp my programming language: http://dl.getdropbox.com/u/820389/clj02.png
14:08antifuchsok, so I am really happy with what clojure has let me do so far
14:08antifuchsrhickey: thanks for making this (-:
14:08rhickeyantifuchs: you're welcome!
14:08antifuchsand to all the other contributors, of course (-:
14:12durka42and looks strangely at the backwards smiley
14:24cemerickChouser: Titanium PR3 came out today. Ironically, applets have been disabled. :-(
14:26Chouser_cemerick: hmph
14:27cemerickyeah. As I was reminded when I mentioned it, "these are just preview releases". I guess it's gonna need another 6 months in the oven.
14:28cemerickChouser_: it was very nice to meet you, BTW. Good to put a face to the handle :-)
14:30Chouser_cemerick: you too! really, it was all far more fun than I'd like to admit.
14:30cemerickindeed
14:30Chouser_you need applets to get at the liveconnect that you need to drive it from clojure?
14:30rhickeygreat seeing both of you guys and the (many) other Clojure users there
14:31cemerickwell, I'm just trying to replace swing, which doesn't look likely in the very near future now.
14:31cemerickrhickey: likewise.
14:31Chouser_rhickey: thanks for taking the time to hang out with us. I had a blast.
14:32cemerickNothing beats getting to know people face-to-face.
14:32Chouser_cemerick: jna + cocoa?
14:33cemerickChouser_: need to be on windows :-[
14:33rhickeycemerick: why not just Safari?
14:33cemerickit's odd to me that the ILC is only every other year. I'd think they wouldn't have any trouble getting similar attendance every year.
14:33Chouser_jna + gtk? :-)
14:33cemerickChouser_: ha-ha ;-)
14:35cemerickrhickey: ...or Firefox. Yeah, I've thought of it. That's a lot of bailing wire and duct tape, tho -- at least, in order to get to the degree of UX I'd like.
14:35cemerickSwing sucks, but it's still just java, so the deployment story is really easy.
14:36cemerickso, I guess my 'swing sucks' line is really hyperbolic.
14:36Chouser_cemerick: do you have a link for titanium? Google's confused by the synonyms.
14:37Chouser_swing is the worst ui toolkit, except for all the others?
14:37cemerickChouser_: exactly!
14:37cemerickhttp://titaniumapp.com/
14:37cemerickLooks like they've pulled PR3, though.
14:37hiredman#java spent an hour or so panning AWT a few days ago
14:38cemerickchatter of some last minute win32 bugs in the titanium irc causing them to pull the release.
14:39cemerickrhickey: I checked around on jwebpane this morning -- looks like the code's done, they're just waiting for "marketing" to allow them to release it (http://weblogs.java.net/blog/alex2d/archive/2008/12/jwebpane_projec_1.html)
14:40rhickeycemerick: yeah, that's the last I'd seen
14:40cemerickof course, that's been the line for 6 months now
14:40Chouser_titanium + jetty?
14:42cemerickChouser_: already semi-supported, apparently: http://appcelerator.org/
14:42Chouser_I guess you'd need something to run the async connection from the "client" side. Hm...
14:42cemericknot really appropriate for our use case, but I can imagine it being very useful elsewhere
14:42cemerickrhickey: agreed.
14:43Chouser_Qt comes with a webkit widget -- plug in jambi and I bet you've got something.
14:43Chouser_Even if jambi withers, whatever webkit thing is available later may be similar enough to allow for easy migration.
14:44Chouser_the pull of already functioning code is strong for me.
14:46waltersthere's also SWT
14:48cemerickwalters: ugh. no-go on 64-bit still, right?
14:48sohailChouser, jambi is going to be discontinued I think
14:48walterscemerick: i'm running eclipse on a 64 bit fedora install right now, but if you're talking about OS X or windows, i have no idea
14:50Chouser_jambi will no longer be supported by trolltech, as cemerick reminds me frequently. But I brought it up anyway because the APIs of webkit itself vs. what jambi would expose to Clojure would by very similar.
14:50walterswell...
14:50cemerickwalters: I think it's more related to 64-bit java -- I have an swt app here that I need to explicitly launch with java 1.5 32-bit, or it crashes.
14:50Chouser_...such that when something else became available, migrating from jambi to the new thing might be pretty straightforward.
14:51cemericklooks like 64-bit swt on OS X is now in 'early access'
14:51waltersChouser_: depends what you want to do i guess; if you just want a toplevel window with webkit taking the whole thing maybe you can use it without a toolkit, but you really want a "normal" toolkit like Qt/GTK/SWT containing it i think
14:51cemerickhrm, I guess I get a little pedantic on the jambi support issue ;-)
14:51walterscemerick: on OS X?
14:52cemerickwalters: yeah; FWIW: http://download.eclipse.org/eclipse/downloads/drops/S-3.5M4-200812111908/eclipse-news-M4.html
14:53cemerickI suppose I should consider swt in general given the ibm/sun snit
15:07Lau_of_DKGood evening gents
15:08durka42hi lau
15:15hiredmanhow can I create a namespace qualified keyword?
15:15rhickey:foo/bar
15:15cmvkk:foo/bar
15:15hiredmanhow can I programatically create a namespace qualified keyword?
15:16hiredman:P
15:16rhickey(keyword "foo" "bar")
15:17durka42(in-ns foo) ::bar
15:17durka42'
15:18hiredmanwell, that makes sense
15:55clojurebothttp://groups.google.com/group/clojure/browse_thread/thread/bba604cee3b232d9/28837d55525306d8?lnk=gst&amp;q=recursive+macroexpand#28837d55525306d8
15:56stuhoodis clojurebot thinking for himself?
15:56durka42clojurebot: are you sentient now?
15:56clojurebotexcusez-moi
15:58stuhoodof course he'd play dumb: he doesn't want us to know he's aware
15:59brianh2speaking of keywords, I noticed that the destructuring with :keys doesn't work with ns qualified keywords. Is that intentional?
16:01clojurebotshuffle is http://groups.google.com/group/clojure/msg/a2816f1b51d99b79
16:01hiredmanhmmm
16:01Carkehiredman : btw i've been trying to talk to clojurebot in a query connection, but he continues talking in the main channel
16:02Carkemaybe that's what you get here
16:03brianh2i got kicked. anyone respond to my question?
16:03hiredmanCarke: I just privmsg'ed him and he responded in a privmsg
16:04Carkeyes he does but look at this
16:04Carkesee ?
16:04hiredmanwhat?
16:04cconstantine~def time
16:05hiredmanCarke: I see nothing
16:05Carkewell i've been privately asking him ~def str
16:05Carkei was hoping not to spam the clojure channel with my queries
16:05hiredmanuh
16:06hiredmanclojurebot responds to ~def stuff with a NOTICE
16:06hiredmanwhich, if you are in a privmsg,, should still go to you only
16:06hiredman(which it does here)
16:06Carkeok so you didn't see my ~def str notice ?
16:07hiredmannope
16:07brianh2,((fn [{:keys [x y]}] (prn x y)) {:x 5 :y 6})
16:07clojurebot5 6
16:08brianh2,((fn [{:keys [x y]}] (prn x y)) {::x 5 ::y 6})
16:08clojurebotnil nil
16:08Carkegood ! must be my irc client showing it in the clojure channel, sorry about that
16:08hiredman,::x
16:08clojurebot:sandbox/x
16:08kotarakbrianh2: how would you do that? you cannot fully qualify the symbol, which is used for the destructuring, since it refers another namespace. And you cannot just use the name part. What happens in this case: {:x 5 ::x 6}?
16:09brianh2kotorak: not sure
16:11brianh2but i was hoping to not pollute the global keyword space with some maps i was creating & then tried to use :keys
16:12Chouser_warms the heart: http://twitter.com/csebold/statuses/1396317051
16:12cemerickglobal keyword space?
16:12hiredman(ha ha horatio)
16:13brianh2cemerick: k. i'm not sure where :x keywords are placed...
16:13hiredmanwhy would they be placed anywhere?
16:14cemerickI suppose there might be some interning going on somewhere, but that won't affect anything you need to worry about.
16:15hiredmankeywords are not symbols, they don't have associated storage
16:15cemerickthere we go, then
16:15Chouser_clojure.lang.Keyword.table is where all keywords are interned
16:16cemerickhiredman: you've led me astray! ;-)
16:16hiredmaneven if you have :x twice, they cannot conflict unless it is in the same hashtable
16:16hiredmancemerick: I did not mean keywords are not stored somewhere
16:16brianh2hmmm.... so there's no need to use ::
16:16cemerickare there any real reason for namespaced keywords at the moment, aside from multimethod hierarchies?
16:16kotarakbrianh2: there is no such thing as a "keyword namespace", but what maybe fits your intention: {:spaceA/foo 5 :spaceB/foo 6}. So spaceA and spaceB can add stuff to the map, without interferring with each other.
16:16hiredmanI mean values are not stored "in" keywords
16:17hiredmankeywords are just, you know, like ??
17:27slashus2Why is hash-map and hash-set overloaded to take no arguments, but sorted-map isn't? It seems that just calling (. clojure.lang.PersistentHashSet (create '())) returns #{} just fine.
17:27slashus2,(. clojure.lang.PersistentHashMap (create '()))
17:27clojurebotjava.lang.IllegalArgumentException: No value supplied for key: null
17:27slashus2hm
17:36slashus2I wonder if it would be helpful to implement hash-map, sorted-map, etc. to take in a map of another kind, not just key value pairs. (sorted-map {:a 5 :b 6}) will return a sorted map. May be useful in translating larger maps into sorted maps. In that case, it may have been useful to start with a sorted-map to begin with. (into (sorted-map) {:a 5 :b 6}) works I guess.
17:39hiredman,(clojure.lang.PersistentHashMap. {:a 1 :b 2})
17:39clojurebotjava.lang.IllegalArgumentException: No matching ctor found for class clojure.lang.PersistentHashMap
17:39hiredman~def c.l.PersistentHashMap
17:40slashus2That way It would have the effect of coercion.
17:40slashus2As well as initialization.
17:41hiredman,(. clojure.lang.PersistentHashMap (create {:a 1 :b 2}))
17:41clojurebot{:a 1, :b 2}
17:42slashus2,(. clojure.lang.PersistentTreeMap (create {:b 1 :a 2}))
17:42clojurebot{:a 2, :b 1}
17:42slashus2:-)
17:42durka42,(sorted? (clojure.lang.PersistentTreeMap/create {:a 1 :b 2}))
17:42clojurebottrue
17:43slashus2It is just how the sorted-map is implemented in the core.
17:44durka42in the core it is
17:44durka42,(clojure.lang.PersistentTreeMap/create '(:b 2 :a 1))
17:44clojurebot{:a 1, :b 2}
17:45slashus2right
17:49cemerickChouser: who came up with "Member of the Technical Staff"?
18:18kefkaI have a question about the interning of keywords... Won't processing of an arbitrary collection of keyworkds cause a memory leak?
18:24cconstantinewhy do you think it would?
18:25brianh2kefka: crossed my mind too. doesn't look like weakhashmap would work in it's place due to == use. was also wondering about how String.intern() works under the covers since that's where all symbols go to live
18:26hiredman~jdoc String
18:30slashus2brianh2: The private string pool?
18:38kefkacconstantine: SBCL has this problem. Every symbol you use (even if just for language/comparison) gets interned.
18:38kefkaSo you have to be careful not to generate a bunch of junk symbols in production code.
18:40slashus2kefka: Do you notice a leak in your applications?
18:41hiredman~def c.l.Symbol
18:41kefkaslashus2: No, but I'm about to build something for production that uses a lot of keywords.
18:46slashus2Looks like the way Symbol is implemented, it keeps a pool of symbols in String?
18:46clojurebothttp://clojure.org/data_structures#toc10
18:50hiredmanbtw there is now a 1 in 20 chance clojurebot will respond to something even if it is not addressed to it
18:50slashus2hiredman: I noticed :-)
18:51ChousukeInteresting :P
18:55duderdoHi
18:56duderdoQuick question, how do I join two sets? Conj puts on in the other.
18:56Chousukeclojure.set/join I think
18:56Chousuke(doc join)
18:56clojurebotTitim gan �ir� ort.
18:56duderdoThanks.
18:56Chousukehm, I guess clojurebot doesn't import the namespace :p
18:57duderdohehe
18:57duderdoYou sure are johnny on the spot in this chatroom chousuke
18:57duderdoMuch appreciated
19:20antifuchskefka: little addendum: all common lisps, as specified have that problem. the general advice is that if you're worried that interning strings will take up memory later on, don't intern strings (or unintern them once you don't need them anymore)
19:20clojurebotNo entiendo
19:21hiredmanmaybe 1 in 20 is too low
19:21dreishMaybe it should keep quiet instead of giving the "I don't understand" answers, in the random case.
20:13slashus2Is there a tutorial somewhere that will help in understanding how to use zippers to create something like a binary tree, red-black tree, etc.
20:37danlarkinEvening clojurecrats!
21:20cmvkk'clojurecrats'
21:20cmvkkwell i'm glad someone came up with a term
21:22jhawk28term for what?
21:24durka42for those who believe the clojure is the Way?
21:24durka42or the Language, anyway
21:24jhawk28I thought that was everyone ;)
21:30danlarkinhaha a few months ago on the mailing list there was a 'what should we call users of clojure' thread
21:30danlarkinno conclusion was reached
21:31cmvkkby mailing list do you mean google group, or is there also a mailing list
21:31durka42i like clojurians myself
21:31danlarkinmailing list == google group
21:31jhawk28clojurites
21:31cmvkkclojurians sounds like we're from another planet
21:32danlarkinmy favorites are pythonistas and djangonauts
21:32slashus2Brazilians?
21:32slashus2are from another planet?
21:38jhawk28what about clabangos?
21:39slashus2lol
21:58danlarkinhahah -1 to clabangos
22:46chessguyhi
22:46Chouserhi
22:47chessguynew to clojure here. seems like it has some interesting ideas to it
22:49Chouserchessguy: preaching. choir. :-)
22:50chessguyhaha, fair enough. i was mainly not being the guy that comes in and says "hi. your language sucks"
22:50Chouserwell, that's appreciated.
22:50chessguyis there a collection of clojure libraries/programs somewhere?
22:50cmvkkhas anyone done that yet?
22:50Chousercmvkk: yeah, but not often.
22:51chessguycmvkk, it's a revered internet pasttime
22:51chessguywell, maybe not revered
22:51Chouserchessguy: http://code.google.com/p/clojure-contrib/source/checkout
22:51cmvkkalso see sites like github
22:51chessguyoh nice
22:58chessguyhm, i'm trying to decide how i want to go about learning clojure
23:00Chouserpick a project, write it in clojure?
23:01chessguyyeah, thinking of doing a chess engine. could be fun. just...not very introductory :)
23:02Chouserprojecteuler.net has nice introductory puzzles
23:02cmvkkspeaking of learning stuff,
23:03chessguyyeah, euler stuff tends to be a little too mathy for me though
23:03cmvkki feel like i should learn the basics of Java to get a better grip on clojure...is there a good java book or resource for people who already know how to program?
23:04chessguycmvkk, i personally like Dietel & Dietel for the exercises
23:04chessguyand i greatly DIS-like Eckel's books
23:05cmvkkheh.
23:05cmvkki have a deitel perl book and it seemed pretty good so that might not be a bad idea
23:05clojurebotbook is http://www.pragprog.com/titles/shcloj/programming-clojure
23:05chessguydeitel perl? interesting
23:05chessguyhaven't seen that one
23:05cmvkki think anyway...i didn't actually read it. i had to buy it for a class but i already knew perl
23:06chessguywow, there's a programming clojure book already? i thought clojure was very new
23:06cmvkkthis is cutting edge man...you should have seen how the guy had to keep changing the book in order to keep up with new features during its production
23:08chessguypretty impressive considering that haskell just finally got its first serious book
23:28chessguywow, the reference section on clojure.org is pretty hard-core