#clojure log - Mar 26 2009

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:09 Puzzler: So 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?

0:38 cconstantine: Is there anyway to iterate over a map and create a new map... something like (map ...) that returns another map instead of a list

0:41 durka42: there's a function i wrote :)

0:41 cconstantine: :P

0:43 lisppaste8: durka42 pasted "mapmap" at http://paste.lisp.org/display/77618

0:44 durka42: Clojure=> (mapmap str + {"a" 1 "b" 2} {"c" 0.5 "d" 0.1})

0:44 {"bd" 2.1, "ac" 1.5}

0:48 Clojure=> (mapmap (comp keyword (partial apply str) #(map name [%1 %2])) + {:a 1 :b 2} {:c 0.5 :d 0.1})

0:48 {:bd 2.1, :ac 1.5}

0:48 :)

0:50 cconstantine: I'm gonna have to spend some time understanding that

0:51 durka42: comp is like nesting the functions ((comp a b c) ...) => (a (b (c ...)))

0:51 cconstantine: you didnt use comp

0:51 oh, your use of it

0:52 not that, the actual defn of mapmap

0:52 durka42: oh you meant the function itself

0:52 cconstantine: it creates a list of keys, values then zips it... ok

0:52 durka42: imagining that kf == vf == identity might help trace through it

0:53 cconstantine: yeah, I got it

1:17 nascent16: is there a non-lazy form of concat?

1:19 nevermind, the lazy one works fine :)

1:21 cconstantine: lazy is generally good. if you need to force it to evaluate you can always (last ...) it

1:22 nascent16: yeah, my question is actually a bit more naive

1:22 cconstantine: no probs

1:22 nascent16: ,(+ (concat [3, 4] [5,6]))

1:22 clojurebot: java.lang.ClassCastException

1:23 nascent16: i want to use the concatenation of the vectors as the argument to +

1:23 cconstantine: Is 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)

1:23 what do you want that to return?

1:24 nascent16: (+ 3 4 5 6)

1:24 clojurebot: *suffusion of yellow*

1:24 nascent16: ,(+ 3 4 5 6)

1:24 clojurebot: 18

1:24 cconstantine: ,(reduce + [3 4] [5 6])

1:24 clojurebot: java.lang.ClassCastException: clojure.lang.LazilyPersistentVector cannot be cast to java.lang.Number

1:24 cmvkk: cconstantine, you can use multiple arities in defmacro just like in defn.

1:25 cconstantine: ,(reduce + (concat [3 4 ] [5 6]))

1:25 clojurebot: 18

1:25 nascent16: cmvkk: I've had trouble doing that in the past, is it exactly the same?

1:25 nice

1:25 thank cconstantine

1:25 *thanks

1:25 cconstantine: cmvkk: I had problems with that a few minutes ago

1:25 cmvkk: i think defmacro is really just a defn that also alters some metadata.

1:25 so it should be exactly the same.

1:25 cconstantine: nascent16: :)

1:26 cmvkk: it works like that now

1:26 replaca: durka42: how is mapmap useful if you don't know a priori the order of keys?

1:26 cconstantine: so, yeah

1:26 cmvkk: also, this is the second time i've seen someone suggest using 'last' to force eval a lazy sequence.

1:26 isn't that what doall is for?

1:27 or is it different in some way?

1:27 * cconstantine goes to read the doall docs

1:27 nascent16: ,(doc doall)

1:27 clojurebot: "([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."

1:27 cconstantine: yup, doall sounds better than last

1:27 cmvkk: also

1:27 ,(doc dorun)

1:27 clojurebot: "([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."

1:28 durka42: replaca: 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

1:28 nascent16: so i lied a little bit, my example was too simple and i don't think reduce will work for what i'm actually doing

1:28 i have two lists of agents, and i want to (await) all of them

1:29 replaca: durka42: but you're examples were combing elements from each map, does this make sense?

1:29 cconstantine: I 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

1:29 nascent16: so i want to append the lists and pass the appended list as the arguments to await

1:29 durka42: oh, i see what you mean

1:30 replaca: cconstantine: yeah, that usage makes sense to me (though I've just used a lambda with map for that)

1:30 durka42: i guess it is more useful with maps that come from sorted-map

1:30 ,(sorted-map :a 1 :b 2)

1:30 clojurebot: {:a 1, :b 2}

1:30 durka42: ,(= {:a 1 :b 2} (sorted-map :a 1 :b 2))

1:30 clojurebot: true

1:31 durka42: ,(= {:b 2 :a 1} (sorted-map :a 1 :b 2))

1:31 clojurebot: true

1:31 durka42: interesting

1:31 nascent16: maps are sorted by default?

1:31 durka42: no

1:31 cconstantine: replaca: I did a (zipmap (keys the-map) (vals ...)) (wel, something similar

1:31 durka42: ,(sorted? {:a 1 :b 2})

1:31 clojurebot: false

1:31 nascent16: hm

1:31 replaca: no, I think = just checks to see if they have the same elements

1:31 durka42: http://clojure.org/data_structures#toc17

1:31 cconstantine: I noticed unsorted maps produce keys and values with keys/vals in a random order, but the keys and vals were in the same order

1:31 durka42: that paragraph is kind of dense

1:32 replaca: that is for map a and map b, is (= (count a) (count b)) and foreach element in a is it also in b

1:32 yeah, small maps are order by insertion order

1:32 ,(class {:a 1})

1:32 clojurebot: clojure.lang.PersistentArrayMap

1:32 replaca: that's it: array maps!

1:33 * durka42 goes to bed

1:33 cconstantine: so, should (zip-map (keys the-map) (vals the-map)) produce a map that is equal to the-map?

1:33 * replaca seconds that plan

1:33 replaca: I think so

1:34 * cconstantine thirds it.

1:34 durka42: ,(let [m (apply hash-map (interleave (range 1000) (range 1000 2000)))] (= m (zipmap (keys m) (vals m))))

1:34 clojurebot: true

1:35 cconstantine: fantastic

1:35 durka42: clojurebot fourths it

1:35 cconstantine: it's true once so it shall always be true

1:35 durka42: computer science be damned

1:35 cconstantine: hehe

1:36 (defn multiple [x y] (+ x y)) ; works for (multiple 2 2), therefore it's good to go

1:36 durka42: CS: 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!

1:37 ;)

1:37 cconstantine: :0

1:37 cmvkk: good enough for government work, as they say.

1:37 cconstantine: indeed

1:38 nascent16: ok, this argument expansion thing is confusing me

1:38 * durka42 notices that i am already marked as away

1:38 durka42: well, now i really am

1:41 but i can't leave without the obligatory xkcd... http://xkcd.org/221/

1:43 nascent16: ah!

1:43 ,(doc apply)

1:43 clojurebot: "([f args* argseq]); Applies fn f to the argument list formed by prepending args to argseq."

1:43 nascent16: exactly what i'm looking for

2:12 hiredman: ~def c.l.Compiler

2:14 ~def load-file

6:30 AWizzArd: clojurebot: max people

6:31 clojurebot: max people is 164

6:55 djpowell: what is the #_ macro for exactly?

6:59 Cark: ,(do (print "hello") #_(print "djpowel"))

6:59 clojurebot: hello

6:59 Cark: it "comments" the next form

6:59 ,(do (print "hello") (print "djpowel"))

6:59 clojurebot: hellodjpowel

7:09 djpowell: Hmm, why would you want to do that though?

7:10 Cark: maybe you want to disable some functionality in a function you're testing

7:10 like logging or whatever

7:19 antifuchs: or binary search for bugs using a structure editor like paredit. M-<number> M-(, #_ - and you've commented out <number> forms following point. useful sometimes

7:23 AWizzArd: djpowell: 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.

7:23 ,(+ 1 2 (comment 3))

7:23 clojurebot: java.lang.NullPointerException

7:23 AWizzArd: ,(+ 1 2 #_3)

7:23 clojurebot: 3

7:38 lepassive: Hi, I know python, learned scheme before and I do Haskell, what does Clojure have to offer ?

7:40 durka42: you might read http://clojure.org/rationale and some of the other things along the sidebar there

7:42 antifuchs: btw, the wikispaces guy I talked to said they're working on nicer reload behavior. they plan to update it in a week or so.

7:42 Cark: antifuchs : great news !

7:42 lepassive: durka42, Yes thanks i checked it before asking. just wondering about its benefits for me maybe migrating to coljure in the firm stuff like that

7:43 durka42: antifuchs: as in faster?

7:43 antifuchs: durka42: well, hopefully (:

7:44 Cark: lepassive : with clojure you get comprehensive persistent data structures, agents and STM right of the box

7:45 and all the java libraries

7:46 lepassive: Cark, Hmmmmm okay what about concurrency ? compared to Haskell or Erlang ?

7:46 Cark: you have agents which are sort of like but not quite like erlang

7:46 and STM for shared state

7:46 durka42: there is very good support for fast immutable data structures

7:46 which help

7:47 lepassive: Cark, 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?

7:48 Cark: you have the doc and find-doc commands, then the web site has it all

7:49 lepassive: Okay Cark thanks for your patience I'll give clojure a shot :)

7:49 Cark: you will love it =)

7:50 lepassive: Cark, I'm sure i'll :)

7:58 Cark: what's the rationale behind the fact that agent send is not queued before the current agent returns ?

8:01 rhickey: Cark: 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

8:02 Cark: ,(doc release-pending-sends)

8:02 clojurebot: "([]); 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."

8:03 Cark: rhickey : that makes sense, thanks !

8:08 ~def release-ending-sends

8:08 ~def clojure.lang.Agent

8:47 antifuchs: this is odd. I can't connect to different ports in the same emacs session using swank-clojure

8:47 (that's with a slime updated from CVS yesterday)

8:48 connecting to clojure and an sbcl works fine. just connecting to two clojure instances doesn't. hangs emacs inside slime-accept-process-output.

8:48 anyone else see that before?

8:49 I don't see anything conspicuous inside swank-clojure.el; think this might be on the clojure swank side?

8:52 oops. something is sending something called swank::*load-path* across; this is causing an exception and aborts the repl creation. odd.

8:57 ok, so that was redshank. note to self: try with a clean environment first (-:

8:58 AWizzArd: antifuchs: you are making good progress :)

8:58 antifuchs: AWizzArd: yes, I'm pretty amazed myself (:

9:00 btw, 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 ((:

9:16 AWizzArd: good

9:22 When 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?

9:24 antifuchs: hmm. what is the preferred way to indent cond clauses?

9:24 it seems that the condition and consequent should be on the same line, but that sometimes results in too-long lines. any alternatives?

9:27 AWizzArd: I usually try to make this consistent. An option could be (condition 1)\n(form )\n(condition 2)\(form 2)\...

9:27 uhm \ ==> \n

9:28 Chouser: I sometimes indent the consequents one extra level

9:29 AWizzArd: In principle it would make sense if the editor/ide would do this automatically.

9:31 antifuchs: yeah. I initially thought cond would take a [condition consequent] vector for each one

11:21 st3fan: that's the one that bill clementson's tutorials and scripts use, so it's what I have been using

11:24 cconstantine: ~def defn

11:28 is tehre anyway to have named optional arguments? if so, how?

11:28 st3fan: ok i got slime working too now

11:28 good good

11:29 cconstantine: or not even optional.. but named so they can go in any order

11:29 st3fan: slime integration is not as nice as sblc yet it seems, but it will do the trick

11:29 Cark: (let [hello (fn [{:keys [name]}] (println "hello, " name))] (hello {:name constantine}))

11:29 ,(let [hello (fn [{:keys [name]}] (println "hello, " name))] (hello {:name constantine}))

11:29 clojurebot: java.lang.Exception: Unable to resolve symbol: constantine in this context

11:29 Cark: ,(let [hello (fn [{:keys [name]}] (println "hello, " name))] (hello {:name "constantine"}))

11:29 clojurebot: hello, constantine

11:30 cconstantine: fantastic :)

11:30 so, not really but it can look a lot like it

11:30 Cark: right

11:31 there is syntax for default value too

11:32 cconstantine: how does that look?

11:32 Cark: ,(let [hello (fn [{:keys [name] :or {:name "unknown person"}}] (println "hello, " name))] (hello {:name "constantine"}))

11:32 clojurebot: hello, constantine

11:32 Cark: ,(let [hello (fn [{:keys [name] :or {:name "unknown person"}}] (println "hello, " name))] (hello {}))

11:32 clojurebot: hello, nil

11:32 Cark: hum

11:33 ,(let [hello (fn [{name :name :or {name "unknown person"}}] (println "hello, " name))] (hello {}))

11:33 clojurebot: hello, unknown person

11:34 cconstantine: that looks kinda ugly in the arg-listing... but nice and clean in the function body and calling

11:35 and I'm not really sure how I'd make it more clean in the arg-listing

11:35 Cark: right, you may just define your function like this : (fn [the-map] ... then do the destructuring in a let form

11:35 that's the same syntax

11:35 cconstantine: that's all that is right, destructuring binding in the argument list

11:37 Cark: it's nice to have the destructuring in the arg list, that way slime shows what is required when you use the function

11:37 cconstantine: yeah

11:38 Cark: but yeah it's a bit ugly !

11:38 cconstantine: i'm not saying it's a bad thing, it's a neat reuse of a feature

13:37 fyuryu: pimp my programming language: http://dl.getdropbox.com/u/820389/clj02.png

14:08 antifuchs: ok, so I am really happy with what clojure has let me do so far

14:08 rhickey: thanks for making this (-:

14:08 rhickey: antifuchs: you're welcome!

14:08 antifuchs: and to all the other contributors, of course (-:

14:12 * durka42 seconds the thanks

14:12 durka42: and looks strangely at the backwards smiley

14:24 cemerick: Chouser: Titanium PR3 came out today. Ironically, applets have been disabled. :-(

14:26 Chouser_: cemerick: hmph

14:27 cemerick: yeah. 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:28 Chouser_: it was very nice to meet you, BTW. Good to put a face to the handle :-)

14:30 Chouser_: cemerick: you too! really, it was all far more fun than I'd like to admit.

14:30 cemerick: indeed

14:30 Chouser_: you need applets to get at the liveconnect that you need to drive it from clojure?

14:30 rhickey: great seeing both of you guys and the (many) other Clojure users there

14:31 cemerick: well, I'm just trying to replace swing, which doesn't look likely in the very near future now.

14:31 rhickey: likewise.

14:31 Chouser_: rhickey: thanks for taking the time to hang out with us. I had a blast.

14:32 cemerick: Nothing beats getting to know people face-to-face.

14:32 Chouser_: cemerick: jna + cocoa?

14:33 cemerick: Chouser_: need to be on windows :-[

14:33 rhickey: cemerick: why not just Safari?

14:33 cemerick: it'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:33 Chouser_: jna + gtk? :-)

14:33 cemerick: Chouser_: ha-ha ;-)

14:35 rhickey: ...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:35 Swing sucks, but it's still just java, so the deployment story is really easy.

14:36 so, I guess my 'swing sucks' line is really hyperbolic.

14:36 Chouser_: cemerick: do you have a link for titanium? Google's confused by the synonyms.

14:37 swing is the worst ui toolkit, except for all the others?

14:37 cemerick: Chouser_: exactly!

14:37 http://titaniumapp.com/

14:37 Looks like they've pulled PR3, though.

14:37 hiredman: #java spent an hour or so panning AWT a few days ago

14:38 cemerick: chatter of some last minute win32 bugs in the titanium irc causing them to pull the release.

14:39 rhickey: 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:40 rhickey: cemerick: yeah, that's the last I'd seen

14:40 cemerick: of course, that's been the line for 6 months now

14:40 Chouser_: titanium + jetty?

14:41 * rhickey would much prefer JWebPane over Titanium

14:42 cemerick: Chouser_: already semi-supported, apparently: http://appcelerator.org/

14:42 Chouser_: I guess you'd need something to run the async connection from the "client" side. Hm...

14:42 cemerick: not really appropriate for our use case, but I can imagine it being very useful elsewhere

14:42 rhickey: agreed.

14:43 Chouser_: Qt comes with a webkit widget -- plug in jambi and I bet you've got something.

14:43 Even if jambi withers, whatever webkit thing is available later may be similar enough to allow for easy migration.

14:43 * cemerick was off by only 80 seconds in guessing when Chouser_ would mention Qt ;-)

14:44 Chouser_: the pull of already functioning code is strong for me.

14:46 walters: there's also SWT

14:48 cemerick: walters: ugh. no-go on 64-bit still, right?

14:48 sohail: Chouser, jambi is going to be discontinued I think

14:48 walters: cemerick: 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:50 Chouser_: 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:50 walters: well...

14:50 cemerick: walters: 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:50 Chouser_: ...such that when something else became available, migrating from jambi to the new thing might be pretty straightforward.

14:51 cemerick: looks like 64-bit swt on OS X is now in 'early access'

14:51 walters: Chouser_: 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:51 cemerick: hrm, I guess I get a little pedantic on the jambi support issue ;-)

14:51 walters: cemerick: on OS X?

14:52 cemerick: walters: yeah; FWIW: http://download.eclipse.org/eclipse/downloads/drops/S-3.5M4-200812111908/eclipse-news-M4.html

14:53 I suppose I should consider swt in general given the ibm/sun snit

15:07 Lau_of_DK: Good evening gents

15:08 durka42: hi lau

15:15 hiredman: how can I create a namespace qualified keyword?

15:15 rhickey: :foo/bar

15:15 cmvkk: :foo/bar

15:15 hiredman: how can I programatically create a namespace qualified keyword?

15:16 :P

15:16 rhickey: (keyword "foo" "bar")

15:17 durka42: (in-ns foo) ::bar

15:17 '

15:18 hiredman: well, that makes sense

15:55 clojurebot: http://groups.google.com/group/clojure/browse_thread/thread/bba604cee3b232d9/28837d55525306d8?lnk=gst&q=recursive+macroexpand#28837d55525306d8

15:56 stuhood: is clojurebot thinking for himself?

15:56 durka42: clojurebot: are you sentient now?

15:56 clojurebot: excusez-moi

15:58 stuhood: of course he'd play dumb: he doesn't want us to know he's aware

15:59 brianh2: speaking of keywords, I noticed that the destructuring with :keys doesn't work with ns qualified keywords. Is that intentional?

16:01 clojurebot: shuffle is http://groups.google.com/group/clojure/msg/a2816f1b51d99b79

16:01 hiredman: hmmm

16:01 Carke: hiredman : btw i've been trying to talk to clojurebot in a query connection, but he continues talking in the main channel

16:02 maybe that's what you get here

16:03 brianh2: i got kicked. anyone respond to my question?

16:03 hiredman: Carke: I just privmsg'ed him and he responded in a privmsg

16:04 Carke: yes he does but look at this

16:04 see ?

16:04 hiredman: what?

16:04 cconstantine: ~def time

16:05 hiredman: Carke: I see nothing

16:05 Carke: well i've been privately asking him ~def str

16:05 i was hoping not to spam the clojure channel with my queries

16:05 hiredman: uh

16:06 clojurebot responds to ~def stuff with a NOTICE

16:06 which, if you are in a privmsg,, should still go to you only

16:06 (which it does here)

16:06 Carke: ok so you didn't see my ~def str notice ?

16:07 hiredman: nope

16:07 brianh2: ,((fn [{:keys [x y]}] (prn x y)) {:x 5 :y 6})

16:07 clojurebot: 5 6

16:08 brianh2: ,((fn [{:keys [x y]}] (prn x y)) {::x 5 ::y 6})

16:08 clojurebot: nil nil

16:08 Carke: good ! must be my irc client showing it in the clojure channel, sorry about that

16:08 hiredman: ,::x

16:08 clojurebot: :sandbox/x

16:08 kotarak: brianh2: 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:09 brianh2: kotorak: not sure

16:11 but i was hoping to not pollute the global keyword space with some maps i was creating & then tried to use :keys

16:12 Chouser_: warms the heart: http://twitter.com/csebold/statuses/1396317051

16:12 cemerick: global keyword space?

16:12 hiredman: (ha ha horatio)

16:13 brianh2: cemerick: k. i'm not sure where :x keywords are placed...

16:13 hiredman: why would they be placed anywhere?

16:14 cemerick: I suppose there might be some interning going on somewhere, but that won't affect anything you need to worry about.

16:15 hiredman: keywords are not symbols, they don't have associated storage

16:15 cemerick: there we go, then

16:15 Chouser_: clojure.lang.Keyword.table is where all keywords are interned

16:16 cemerick: hiredman: you've led me astray! ;-)

16:16 hiredman: even if you have :x twice, they cannot conflict unless it is in the same hashtable

16:16 cemerick: I did not mean keywords are not stored somewhere

16:16 brianh2: hmmm.... so there's no need to use ::

16:16 cemerick: are there any real reason for namespaced keywords at the moment, aside from multimethod hierarchies?

16:16 kotarak: brianh2: 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:16 hiredman: I mean values are not stored "in" keywords

16:17 keywords are just, you know, like ??

17:27 slashus2: Why 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:27 ,(. clojure.lang.PersistentHashMap (create '()))

17:27 clojurebot: java.lang.IllegalArgumentException: No value supplied for key: null

17:27 slashus2: hm

17:36 I 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:39 hiredman: ,(clojure.lang.PersistentHashMap. {:a 1 :b 2})

17:39 clojurebot: java.lang.IllegalArgumentException: No matching ctor found for class clojure.lang.PersistentHashMap

17:39 hiredman: ~def c.l.PersistentHashMap

17:40 slashus2: That way It would have the effect of coercion.

17:40 As well as initialization.

17:41 hiredman: ,(. clojure.lang.PersistentHashMap (create {:a 1 :b 2}))

17:41 clojurebot: {:a 1, :b 2}

17:42 slashus2: ,(. clojure.lang.PersistentTreeMap (create {:b 1 :a 2}))

17:42 clojurebot: {:a 2, :b 1}

17:42 slashus2: :-)

17:42 durka42: ,(sorted? (clojure.lang.PersistentTreeMap/create {:a 1 :b 2}))

17:42 clojurebot: true

17:43 slashus2: It is just how the sorted-map is implemented in the core.

17:44 durka42: in the core it is

17:44 ,(clojure.lang.PersistentTreeMap/create '(:b 2 :a 1))

17:44 clojurebot: {:a 1, :b 2}

17:45 slashus2: right

17:49 cemerick: Chouser: who came up with "Member of the Technical Staff"?

18:18 kefka: I have a question about the interning of keywords... Won't processing of an arbitrary collection of keyworkds cause a memory leak?

18:24 cconstantine: why do you think it would?

18:25 brianh2: kefka: 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:26 hiredman: ~jdoc String

18:30 slashus2: brianh2: The private string pool?

18:38 kefka: cconstantine: SBCL has this problem. Every symbol you use (even if just for language/comparison) gets interned.

18:38 So you have to be careful not to generate a bunch of junk symbols in production code.

18:40 slashus2: kefka: Do you notice a leak in your applications?

18:41 hiredman: ~def c.l.Symbol

18:41 kefka: slashus2: No, but I'm about to build something for production that uses a lot of keywords.

18:46 slashus2: Looks like the way Symbol is implemented, it keeps a pool of symbols in String?

18:46 clojurebot: http://clojure.org/data_structures#toc10

18:50 hiredman: btw there is now a 1 in 20 chance clojurebot will respond to something even if it is not addressed to it

18:50 slashus2: hiredman: I noticed :-)

18:51 Chousuke: Interesting :P

18:55 duderdo: Hi

18:56 Quick question, how do I join two sets? Conj puts on in the other.

18:56 Chousuke: clojure.set/join I think

18:56 (doc join)

18:56 clojurebot: Titim gan �ir� ort.

18:56 duderdo: Thanks.

18:56 Chousuke: hm, I guess clojurebot doesn't import the namespace :p

18:57 duderdo: hehe

18:57 You sure are johnny on the spot in this chatroom chousuke

18:57 Much appreciated

19:20 antifuchs: kefka: 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:20 clojurebot: No entiendo

19:21 hiredman: maybe 1 in 20 is too low

19:21 dreish: Maybe it should keep quiet instead of giving the "I don't understand" answers, in the random case.

20:13 slashus2: Is 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:37 danlarkin: Evening clojurecrats!

21:20 cmvkk: 'clojurecrats'

21:20 well i'm glad someone came up with a term

21:22 jhawk28: term for what?

21:24 durka42: for those who believe the clojure is the Way?

21:24 or the Language, anyway

21:24 jhawk28: I thought that was everyone ;)

21:30 danlarkin: haha a few months ago on the mailing list there was a 'what should we call users of clojure' thread

21:30 no conclusion was reached

21:31 cmvkk: by mailing list do you mean google group, or is there also a mailing list

21:31 durka42: i like clojurians myself

21:31 danlarkin: mailing list == google group

21:31 jhawk28: clojurites

21:31 cmvkk: clojurians sounds like we're from another planet

21:32 danlarkin: my favorites are pythonistas and djangonauts

21:32 slashus2: Brazilians?

21:32 are from another planet?

21:38 jhawk28: what about clabangos?

21:39 slashus2: lol

21:58 danlarkin: hahah -1 to clabangos

22:46 chessguy: hi

22:46 Chouser: hi

22:47 chessguy: new to clojure here. seems like it has some interesting ideas to it

22:49 Chouser: chessguy: preaching. choir. :-)

22:50 chessguy: haha, fair enough. i was mainly not being the guy that comes in and says "hi. your language sucks"

22:50 Chouser: well, that's appreciated.

22:50 chessguy: is there a collection of clojure libraries/programs somewhere?

22:50 cmvkk: has anyone done that yet?

22:50 Chouser: cmvkk: yeah, but not often.

22:51 chessguy: cmvkk, it's a revered internet pasttime

22:51 well, maybe not revered

22:51 Chouser: chessguy: http://code.google.com/p/clojure-contrib/source/checkout

22:51 cmvkk: also see sites like github

22:51 chessguy: oh nice

22:58 hm, i'm trying to decide how i want to go about learning clojure

23:00 Chouser: pick a project, write it in clojure?

23:01 chessguy: yeah, thinking of doing a chess engine. could be fun. just...not very introductory :)

23:02 Chouser: projecteuler.net has nice introductory puzzles

23:02 cmvkk: speaking of learning stuff,

23:03 chessguy: yeah, euler stuff tends to be a little too mathy for me though

23:03 cmvkk: i 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:04 chessguy: cmvkk, i personally like Dietel & Dietel for the exercises

23:04 and i greatly DIS-like Eckel's books

23:05 cmvkk: heh.

23:05 i have a deitel perl book and it seemed pretty good so that might not be a bad idea

23:05 clojurebot: book is http://www.pragprog.com/titles/shcloj/programming-clojure

23:05 chessguy: deitel perl? interesting

23:05 haven't seen that one

23:05 cmvkk: i think anyway...i didn't actually read it. i had to buy it for a class but i already knew perl

23:06 chessguy: wow, there's a programming clojure book already? i thought clojure was very new

23:06 cmvkk: this 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:08 chessguy: pretty impressive considering that haskell just finally got its first serious book

23:15 * duck1123 is still waiting for his physical book so he can lend it out

23:28 chessguy: wow, the reference section on clojure.org is pretty hard-core

Logging service provided by n01se.net