#clojure log - Mar 26 2010

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

0:18 phren0logy: can anyone give me a hand with the most recent checkout of labrepl? It seems to have broken the swank server script.

3:08 underdev: is there an idiom for declaring that a function has side effects?

3:09 i have a whole set of functions that use the Robot class, and i would like to refactor them, and convey the fact that they are not pure

3:11 Chousuke: well, you can add a ! to the name

3:11 noidi: I think that's quite common

3:11 that's what I do, too

3:12 I think that comes from scheme http://www.rscheme.org/rs/b/

3:12 Chousuke: it's not always done, though

3:12 underdev: okay, that will work fine

3:13 Chousuke: often, documenting the side-effects is good enough

3:14 underdev: i'm trying to work my way up several layers of abstraction, and at some point i will no longer remember that foo contains side effects

3:14 i know me, and trust me, i won't keep track :)

3:15 won't/can't...

3:24 zmila: underdev - you may use -se postfix or prefix for side-effect functions

3:24 slyphon: i thought the convention was to postfix w/ !

3:48 talios: evening everyone

4:04 LauJensen: Morning all

4:12 talios: 'lo

4:58 gko: hello

5:02 talios: 'lo

5:13 grr - (json-str) is escaping /'s when it outputs "http://xxx" - annoying.

5:16 altho it looks like thats valid behaviour.

6:43 zmila: so quiet for friday ...

6:47 unfo-: zmila, YOU LIEK THIS BETTAR THEN? ^^

6:51 npoektop: sorry. echo check

6:55 manniche: Hi Lau, thanks for your inspiring talk @DKUUG on clojure. Fortunately I'll have the entire Easter holiday to dive (more) into clojure.

6:55 LauJensen: manniche: Hey - My pleasure, I'm glad you decided to try it out :)

7:13 noidi: damn, Enclojure crashes with a NullPointerException when I try to create a new Clojure project

7:14 even upgrading to Netbeans 6.8 didn't help

7:14 LauJensen: noidi: check out my blog

7:14 ~google Clojure IDEs the grand tour

7:14 clojurebot: First, out of 457 results is:

7:14 Clojure IDEs — The Grand Tour | BEST IN CLASS

7:14 http://www.bestinclass.dk/index.php/2010/03/clojure-ides-the-grand-tour-getting-started/

7:15 LauJensen: In the very bottom you see 2 updates to the post explaining how to fix that

7:15 noidi: LauJensen, ah, you got that fixed

7:15 LauJensen: Yes ma'am

7:15 noidi: thanks

7:16 I decided to give a "real" IDE a try after years of Vim and Emacs, but the first impression wasn't too good :)

7:17 LauJensen: Trust me, it gets better than that NPE :)

7:17 noidi: hehe

7:28 yay, updating the plugins seemed to fix the NPE for me

7:38 after 10 minutes it's back to Emacs for me... too many widgets, too little source code -- I can't think in an environment like that! :)

7:39 the problem with being able to discover everything by looking at the app, is that you have to stare at everything all the time :P

7:44 LauJensen: 10 minutes...hmm. I think you did good :)

9:26 It constantly surprises me that Chrome doesn't accept C-x o to switch tabs

9:29 SynrG: LauJensen: C-PgUp, C-PgDn :)

9:29 LauJensen: SynrG: fine, but how do I get C-a C-k working in the adress line?

9:29 SynrG: the whole world has not yet embraced emacs, and you're surprised?

9:30 i don't even know what that does :p

9:30 LauJensen: Move to start of the line then kill line :)

9:31 SynrG: C-a C-x i guess. but now you've trashed your paste buffer. hmmm

9:32 but yeah, it's annoying when your "finger memory" of things doesn't transfer well from app to app

9:33 hmm, C-a Backspace

9:40 * fogus writes transients that makes things slower.

9:42 _2x2l: noidi: netbeans is crap. intellij is the only way to go for java. i duno about clojure since i use emacs, but don't let netbeans taint your idea of what a good ide does.

9:42 i'd imagine intellij might be half decent for clojure, and eclipse is probably halfway decent too (though i bet has a huge memory footprint).

9:44 fogus: _2x21: "imagine"? "probably"? "bet"? Are you not familiar with those IDEs?

9:45 callen: fogus: it's the internet. uninformed conjecture based on gut feeling told around a campfire all the while Alan Kay is rolling in his grave. Questions?

9:45 too bad Alan Kay isn't dead :D

9:45 maybe he sleeps in a coffin.

9:45 yeah, that's it. he rolls in his nightly coffin.

9:46 fogus: callen: Only one... where are my marshmallows? http://www.campo-ongo.org/pics/campfire.jpeg

9:46 callen: fogus: http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=the+hated+campfire

9:48 zmila: ,(let [ [f & r] #{2 3 4}] [f r])

9:48 clojurebot: java.lang.UnsupportedOperationException: nth not supported on this type: PersistentHashSet

9:49 fogus: ,(let [ [f & r] (seq #{2 3 4})] [f r]) ; don't count on order

9:49 clojurebot: [2 (3 4)]

9:52 zmila: tĥ fogus! i see

9:52 thx

9:53 bsteuber: fogus: so why doesn't destructuring call seq for you? too inefficient?

9:53 fogus: zmila: np

9:54 ,[(seq [1]) (seq [])]

9:54 clojurebot: [(1) nil]

9:56 noidi: cemerick, thanks for the interesting blog post and screencast! You convinced me to start reading the maven book :)

10:01 fogus: bsteuber: That's a good question

10:05 bsteuber: I suppose because that defeats the specificities of access per collection type

10:06 ,(let [{x 1, y 2} #{1 2 3 4}] [x y])

10:06 clojurebot: [1 2]

10:07 fogus: ,(let [{x 1, y 2} {1 2 3 4}] [x y])

10:07 clojurebot: [2 nil]

10:07 fogus: ,(let [{x 1, y 2} [1 2 3 4]] [x y])

10:07 clojurebot: [2 3]

10:08 fogus: ,(let [{x 1, y 2} (seq [1 2 3 4])] [x y])

10:08 clojurebot: [nil nil]

10:08 zmila: 8-)

10:14 cemerick: noidi: good to hear :-) Feel free to ping me if you have any questions. Definitely check out the clojure-maven-plugin list http://groups.google.com/group/clojure-maven-plugin, and the #maven channel is also helpful.

10:20 bsteuber: fogus: ic, so map destructuring only works on IFn?

10:21 but when I think it over, it makes sense for array destructuring to only work on sequential? stuff

10:21 as you can't rely on the order otherwise

10:36 wthidden: does doseq hold on its head?

10:36 *to its head

10:36 chouser: hm, shouldn't.

10:37 wthidden: if have a (doseq [k (range 0 100000000000000)] (func 'a 'b))

10:37 that seems to run out of memory after 24 hours or so.

10:39 what about leakage with java udp sockets? Anything special other than closing them when I'm done?

10:41 phren0logy: has anyone been using stuart halloway's LabREPL from github?

10:42 gfodor: what exactly is it? the readme wasn't clear and I didn't pull it

10:43 phren0logy: gfodor: It's a "lab" for learning clojure. But the more recent updates seem to have jacked up the slime server interaction.

10:43 gfodor: It runs a web server with tutorials, and is supposed to set up a repl to try the exercises that have some libraries available

10:44 gfodor: i see

10:44 thx

10:44 phren0logy: sure

10:44 do you use emacs?

10:44 gfodor: vimclojure for me

10:44 lpetit: ,(let [{x 1, y 2} (seq [1 2 3 4])] [x y]) ; why couldn't it result in [2 nil] ?

10:44 clojurebot: [nil nil]

10:45 phren0logy: ah. well I'm trying to trouble shoot why I can't get it to work, but I'm not having much luck. Check it out, you may have better luck.

10:50 bsteuber: ,('(1 2 3 4) 1)

10:50 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn

10:50 bsteuber: lpetit: so seqs are not callable

10:51 phren0logy: I didn't get it to work with swank, be the shell repl and website were okay

10:51 lein deps did the job for me

10:51 phren0logy: bsteuber

10:52 Thanks. I had it working 2 days ago, but the recent updates seem to have broken it

10:52 good to know it's not just me, I wasn't sure if I broke something

10:53 hiredman: lpetit: seqs are not indexed

10:53 bsteuber: ,(let [[x y] (seq [1 2 3 4])] [x y]) ; but they are ordered

10:53 clojurebot: [1 2]

10:56 lpetit: hiredman: yes, I understand that.

10:57 ,(*clojure-version*)

10:57 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: PersistentArrayMap

10:57 lpetit: ,(clojure-version)

10:57 clojurebot: "1.1.0-master-SNAPSHOT"

11:18 licoresse: There is assoc-in, get-in and update-in, is there a dissoc-in or a similar workaround?

11:20 raek: dissoc-in exists in clojure.contrib.core

11:20 licoresse: raek: thanks!

11:26 stuartsierra: What exactly does the &env special macro argument do?

11:27 Chousuke: stuartsierra: it contains the locals expansion environment I think

11:27 locals of the*

11:28 chouser: stuartsierra: gives you a map where the keys are the symbols of all the locals at the point where the macro is being expanded.

11:28 stuartsierra: But not their values, it seems.

11:28 chouser: their values aren't known at compile time. :-)

11:28 er, at macro-expand time.

11:28 stuartsierra: Well, they could be in the case of (let [x 1] ...) but I see the point.

11:28 chouser: the values in the map are Compiler$Something objects, which I expect will change

11:28 stuartsierra: ok

11:29 So basically &env lets a macro inspect its lexical context.

11:30 chouser: yes

11:30 stuartsierra: ok, thanks

11:32 chouser: the value is a Compiler$LocalBinding, which has fields like .isArg (true if it's a fn arg instead of a let-local), .init (a Compiler expression of the analyzed init value, like perhaps a Compiler$ConstantExpr, .tag, etc.)

11:32 stuartsierra: hm, ok

11:32 chouser: but like I said, I think that will change to something a bit more transparent with ccinc

11:32 stuartsierra: right

11:32 ccinc needs a better name

11:32 chouser: for now all I've been able to use &env for is to collect metadata from the local symbol itself.

11:32 stuartsierra: Like "nirvana"

11:33 chouser: (let [#^{:my :meta} i 5] ... (foo i ...))

11:33 stuartsierra: chouser: yes, that makes sense

11:34 chouser: where foo is a macro that at macro-expand time looks up its arg i in &env to find the let's i and from there gets at :my :meta

11:34 drewr: o_O

11:36 chouser: (defmacro foo [local etc] (let [[orig-local _] (find &env local), my-meta (meta orig-local)] ...))

11:36 licoresse: one problem with dissoc-in is that it removes the whole branch, and not only the last leaf

11:39 I have a {:upper {5 #{:d}, 15 #{:d} :lower {20 #{:x}} when dissoc -in [:lower 20] I end up with {:upper {5 #{:d}, 15 #{:d}} what I would like is {:upper {5 #{:d}, 15 #{:d} :lower {}}

11:39 I don't know if this makes any sense to you guys

11:40 everything here is in a (dosync (alter ...)

11:41 drewr: licoresse: I'm following you, and I think I agree

11:41 licoresse: drewr: :) guess a private rewrite of dissoc-in should solve it (?)

11:42 drewr: where is dissoc-in defined?

11:42 Chousuke: ,(dissoc {:a 5} :a)

11:42 clojurebot: {}

11:42 licoresse: contrib.core

11:43 my brain is kind of blasted after 5 days of clojure fun

11:44 Chousuke: I suppose you can do (update-in [:lower] dissoc 20) as a workaround

11:45 licoresse: Chousuke: I'll give it a try...

11:46 Chousuke: but I think the asymmetry of dissoc-in with dissoc can be considered a bug

11:46 licoresse: Chousuke: great, that works!

11:47 wondering why dissoc-in is in contrib and not in core?

11:48 Chousuke: Probably because Rich never needed it, and no-one has proposed adding it to core :)

11:48 licoresse: ah, the benevolent dictator

11:48 chouser: I'm not sure how often removing the whole branch is desirable

11:49 licoresse: just kidding

11:56 drewr: fwiw, I've only ever needed update-in

11:57 and get-in occasionally

11:57 chouser: I tend to use -> instead of get-in

11:57 drewr: chouser++

11:58 AWizzArd: ,(doc get-in)

11:58 clojurebot: "([m ks]); returns the value in a nested associative structure, where ks is a sequence of keys"

12:00 AWizzArd: Hmm yes, I also used -> instead of get-in, but on the other hand get-in better documents the code.

12:00 drewr: wouldn't -?> be better than ->? (wow, that's confusing)

12:01 * drewr checks

12:01 AWizzArd: ,(doc -?>)

12:01 clojurebot: No entiendo

12:01 drewr: no, drewr, get-in handles nil just fine

12:02 chouser: so does -> when all you're using are keywords

12:02 drewr: ah, true

12:11 lithpr: begun the tweet wars about learning java has!

12:12 noss: what happens on twitter stays on twitter

12:12 AWizzArd: chouser: yes, it is clear what -> does, but get-in can be grepped for, and it is more specific. I find that more specific functions document the code better.

12:41 rrc7cz-hm: are there any tricks which allow keywords to have metadata?

12:44 drewr: rrc7cz-hm: what would you like to accomplish?

12:44 a keyword is a named constant; metadata seems orthogonal

12:45 rrc7cz-hm: drewr: I have nested map structures where they keys are keywords. Since they are nested, there is a sort of coordinate system based on keys. For example [:foo :bar] identifies 3 in {:foo {:bar 3}}, much like the zipper fns

12:46 drewr: these maps represent product configurations. I'd like to add metadata to certain coordinates so that the system can identify whether it's visible or not

12:46 for example

12:47 stuartsierra: ,(identical? :foo :foo)

12:47 clojurebot: true

12:47 rrc7cz-hm: I could, of course, simply add a :visible true entry to the relevant coordinate, but visibility really has nothing to do with a product configuration; it's metadata the system would use

12:47 stuartsierra: Keywords are singletons.

12:47 raek: two keywords with the same name are always the same instance

12:48 rrc7cz-hm: stuartsierra: what about namespaced keywords

12:48 drewr: rrc7cz-hm: why not add meta to the coordinate map?

12:48 e.g., (with-meta {:foo {:bar 3}} {[:foo :bar] :visible})

12:48 rrc7cz-hm: ,(identical? ::foo ::foo)

12:48 clojurebot: true

12:48 rrc7cz-hm: well, in the same ns

12:48 raek: rrc7cz-hm: you could use [:foo :bar] as a key and add metadata to that

12:49 rrc7cz-hm: drewr: that's my backup plan, but it's not as nice. I'd basically have a map's metadata shadowing the entire structure of the map itself

12:50 drewr: it seems better to me because now you have an attribute tied to an exact coordinate instead of on :foo or :bar (but maybe that's what you want)

12:50 those vector keys are really useful too with update-in/get-in

12:51 the other option is to not bother with the nested map and just use the meta

12:51 {[:foo :bar] {:visible true :val 3}} or some such

12:51 rrc7cz-hm: raek: I would, but I'm loading directly from couchdb, which only supports assoc arrays (no complex types as keys). I could make the translation, it would just be more work

12:52 the vec as key is a pretty nice option. I'll just have to do a bit more translating

12:54 I'm also wondering if somebody can explain how fn equality is done

12:54 ,(= range range)

12:54 clojurebot: true

12:55 hiredman: rrc7cz-hm: I think it's just reference equality

12:55 rrc7cz-hm: ,(= #(range %) #(range %))

12:55 clojurebot: false

12:55 rrc7cz-hm: okay

12:55 hiredman: ,(identical? range range)

12:55 clojurebot: true

12:55 hiredman: ,(identical? #(range %) #(range %))

12:55 clojurebot: false

12:59 drewr: ,#(range %)

12:59 clojurebot: #<sandbox$eval__4265$fn__4267 sandbox$eval__4265$fn__4267@8690e3>

12:59 drewr: ,#(range %)

12:59 clojurebot: #<sandbox$eval__4272$fn__4274 sandbox$eval__4272$fn__4274@11aed03>

12:59 drewr: ,range

12:59 clojurebot: #<core$range__5186 clojure.core$range__5186@8634b6>

12:59 drewr: ,range

12:59 clojurebot: #<core$range__5186 clojure.core$range__5186@8634b6>

13:00 drewr: rrc7cz-hm: #(..) creates a new, separate lambda each time

13:00 rrc7cz-hm: Just out of curiosity, what kind of issues might you run in to trying to build a logical equality operator for fns?

13:00 drewr: whereas range is a Var that points to the range function

13:00 rrc7cz-hm: I mean, since they're just lists, wouldn't it be fairly straightforward?

13:02 TalkingHead: I have a function that populates a struct, but I'm having trouble getting the struct as my return value...

13:03 from-s (geo-code from "AFRICA")

13:03 (defstruct map-point :name :country :latitude :longitude)

13:03 and then geo-code populates something like this:

13:03 (struct map-point n m lat lon )])

13:05 thelatemrb: quit

13:05 drewr: TalkingHead: paste the code

13:05 (not in here)

13:10 TalkingHead: drewr: http://gist.github.com/345121

13:12 slyphon: technomancy: hey, i'm having a problem with AOT compilation, it seems fairly difficult to compile a bunch of custom exceptions defined with gen-class for use in other parts of my app

13:13 it barfs telling me that those classes couldn't be found while i'm trying to compile those classes

13:13 oh, ffs

13:14 nvm, it was my "user.clj" file, i thought that only got sourced when running the REPL

13:15 ipostelnik: TalkingHead, (prn s) returns nil

13:16 TalkingHead, you can do (let [s ....] (prn s) s)

13:16 drewr: TalkingHead: you're returning the value of doseq from geo-code, which is always nil

13:16 TalkingHead: aha, thx

13:43 alexyk: ,(map (fn [a b] [a b]) [1 2 3] (iterate inc 0))

13:43 clojurebot: ([1 0] [2 1] [3 2])

13:43 alexyk: is there a shorter way to write the fn?

13:44 Chousuke: map vector

13:45 alexyk: ha

13:45 cool

13:49 jcromartie: OK so this is pretty much awesome

13:49 (Thread. #(loop [chars (cycle "|/-\\")] (print "\r" (first chars)) (.flush *out*) (Thread/sleep 100) (recur (rest chars))))

13:50 if you find yourself in need of an ASCII-art spinner

14:56 licoresse: What is the difference between :require and :use in ns?

14:58 never mind: http://stackoverflow.com/questions/871997/use-vs-require-in-clojure

15:04 argh

15:04 No such var: sel/composite-selection

15:04 [Thrown class java.lang.Exception]

15:06 I am (ns ... (:use [something.whatever :as sel])) in the module, but it responds with this ^

15:06 Everything worked a couple of minutes ago

15:06 now, everywhere where I am using sel/composite-selection the compiler complains

15:07 (def composite-selection ....)

15:16 slyphon: technomancy: hey, i'm having a real hard time with AOT compilation and running swank

15:18 licoresse: I needed to (use '....) at the repl, then it worked again

15:18 thats hogwash

15:19 trying to restart emacs to see if I can reproduce

15:23 slyphon: ARRGH

15:24 licoresse: hehe

15:24 I know the feeling

15:25 running swank-clojure-project solves everything, only problems with lein swank

15:25 or better; my lack of understanding

15:59 * fogus wishes clojure ignored ':' within map literals

16:24 slyphon: doh! you can't attach metadata to java objects?

16:24 lame!

16:24 chouser: heh. where would just metadata be stored?

16:24 slyphon: that's someone else's problem!

16:24 :D

16:25 chouser: :-)

16:25 slyphon: chouser: i'm looking at error-kit

16:25 chouser: has to derive from IObj or IMeta to support metadata

16:25 slyphon: oh yeah? and what are you thinking?

16:25 are you thinking "what was he thinking!?"

16:25 slyphon: the reason i was thinking the above because i was like "Oh, i'll just attach some metadata to a RuntimeException instance..."

16:25 no, i understand what you were thinking

16:26 chouser: because I think that's what I think when I think about error-kit

16:26 slyphon: hahahahahah

16:26 it's a little convoluted

16:26 chouser: yes

16:26 too convoluted

16:26 slyphon: very CL-ey

16:26 but

16:26 chouser: in a lot of cases contrib's condition is all you need

16:26 clojurebot: CL conditions is http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html

16:26 chouser: perfect for attaching a little extra data to an exception

16:27 slyphon: the problem i've been having is that i can't seem to get clojure to "see" the AOT compiled Exception subclasses i make

16:27 hmm

16:27 yeah, i looked at that as well, and was similarly baffled

16:29 chouser: rhickey has said error-kit confuses him so that's, you know, a bad sign.

16:29 slyphon: hahahahah

16:29 well, it seems like you're implementing custom stack-unwinding or something

16:29 chouser: yes, in error-kit

16:30 * slyphon nods

16:30 slyphon: ok, i just wanted to make sure i kind of grokked what was goin' on

16:30 chouser: but that's only half the problem. It has a little object system in there that is ill-conceived.

16:30 slyphon: heh

16:31 chouser: basically, error-kit is a fairly thoughtless attempt to support CL conditions in Clojure, plus an extra feature or two just because they were easy to add.

16:31 slyphon: :)

16:32 hrm

16:33 ahhh

16:33 ok, so Condition is a Throwable that implements IMeta

16:35 hmm

16:36 chouser: who would i submit a doc-string patch to?

16:36 i think some of the condition docs could be a little more clear

16:40 technomancy: slyphon: in general I'd suggest sticking with Exceptions if you're having AOT trouble with custom classes

16:40 slyphon: yeah, i think i was just doing it wrong

16:40 technomancy: then go back and replace them with your custom exceptions once you've got a better handle on things

16:41 unnecessary AOT can be a huge time sink

16:41 slyphon: i wasn't 100% aware that you had to make a foo/MyException.clj for (ns foo.MyException {:gen-class :extends Throwable})

16:41 i was trying to put multiple (ns) forms in a single file

16:42 technomancy: aha

16:42 clojurebot: Paul Graham is the creator of the other new lisp

16:42 slyphon: which is fail

16:42 technomancy: gen-class for reasons other than -main and java interop is pretty suspect

16:42 slyphon: but, i'm thinkin' ill just give clojure.contrib.condition a shot

16:45 hiredman: slyphon: the problem there is the ns form, not gen-class

16:45 I would look at using gen-class directly

16:46 slyphon: ah

16:46 ok, that makes sense

16:47 hiredman: http://gist.github.com/34229 from the dawn of time

16:47 slyphon: oooh

16:47 interesting

16:47 hiredman: you still have to aot compile

16:47 * slyphon nods

16:58 slyphon: it'd be nice if there were some variant of (ns (:require [foo.bar [baz :as baz]])) to get rid of the repetition

16:58 unless there is one that i just don't know about

17:01 LauJensen: Whats the fn to check if what Im holding is a primitive?

17:05 technomancy: slyphon: there's talk of adding that; someone has started prototyping it

17:05 slyphon: ah, cool

17:05 yeah, i find myself doing that *a lot*

17:05 technomancy: see the "ns overhaul" thread on the clojure-dev list

17:05 slyphon: ah, cool

17:06 chouser: LauJensen: repl-utils expression-info

17:07 slyphon: do people generally just use clojure.test ?

17:07 technomancy: slyphon: unless you're the author of one of the competing frameworks, you're probably using clojure.test

17:07 slyphon: :)

17:08 are any of the other competinf frameworks any good/worth checking out?

17:08 competing* even

17:08 LauJensen: chouser: thanks

17:08 technomancy: slyphon: not yet, unless you're interested in contributing

17:09 slyphon: ah

17:09 chouser: LauJensen: not it operates on forms (like macroexpand) not on return values

17:09 slyphon: thanks, i have enough of my own shitty code to contend with :)

17:09 LauJensen: chouser: Would be easier if I could check returns, any way to do that?

17:10 alexyk: ,(map (fn [x] [x 1]) [1 2 3]) ; this works

17:10 clojurebot: ([1 1] [2 1] [3 1])

17:10 alexyk: ,(map (fn #([% ]) [1 2 3]) ; this doesn't -- why?

17:10 clojurebot: EOF while reading

17:10 alexyk: ,(map (fn #([% ]) [1 2 3]))

17:10 clojurebot: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol

17:10 slyphon: um

17:11 alexyk: i.e., hod do we do #([% 1]) right with %?

17:11 how

17:11 slyphon: (vec %) ?

17:13 alexyk: I need to return new vectors of two elements, first from the original, second fixed -- here it's 1

17:13 same behavior as (map (fn [x] [x 1]) [1 2 3])

17:13 i.e. the question is to rewrite (fn [x] [x 1]) with #(...%...)

17:14 slyphon: ,(map #(vec (list % 1)) [1 2 3])

17:14 clojurebot: ([1 1] [2 1] [3 1])

17:15 alexyk: ah,

17:15 ,(map #(vector % 1) [1 2 3])

17:15 clojurebot: ([1 1] [2 1] [3 1])

17:15 slyphon: that too :)

17:17 chouser: LauJensen: well, that's a problem since functions only return boxed things.

17:18 LauJensen: chouser: You mean rich has to provide a special form... *hint* *hint*

17:32 licoresse: ,(map vector '1 [1 2 3])

17:32 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

17:32 licoresse: ,(map vector [1] [1 2 3])

17:32 clojurebot: ([1 1])

17:32 hiredman: you have to use repeat

17:32 licoresse: ,(map vector (repeat 1) [1 2 3])

17:32 clojurebot: ([1 1] [1 2] [1 3])

17:32 licoresse: right

17:33 chouser: LauJensen: you should be able to use a debugger to see what the type of a local is -- primitive or otherwise

17:33 alexyk: good good

17:33 LauJensen: chouser: Yea, but this is really an area where I hope Clojure improves rapidly. The lack of reflection warnings and insight into boxing is making optimizing a very tough job

17:36 Raynes: Licenser: ping

17:36 Licenser: Raynes: pong

17:36 Raynes: Licenser: Was there a particular reason that 'def' was whitelisted?

17:36 Seems like something one should whitelist themselves if they need it.

17:36 Because it can pollute the namespace.

17:38 Licenser: Raynes: It was in the lists, not in the whitelist, I guess it slipped in when we went from multiple vars to a map

17:38 Raynes: Ah. It was in variable-fns. I removed it last night.

17:38 slyphon: technomancy: if i want leiningen to compile clojure.contrib.condition.Condition, do i put :namespaces [c.c.c.C] or [c.c.c] ?

17:39 Raynes: As a matter of fact, it is all that was in variable-fns. :p

17:39 Licenser: heh

17:39 Raynes: When I get some time, I'll go through the entire Clojure API and add stuff. I've been busy over the last couple of days.

17:41 slyphon: technomancy: i have :namespaces [clojure.contrib.condition.Condition], but lein compile says "all :namespaces already compiled", but i look in classes/ and the Condition.class file isn't there

17:44 technomancy: slyphon: contrib should be AOT'd for you; no need to do it yourself

17:44 slyphon: oh

17:44 duh

17:44 technomancy: i'm sorry, i'm not normally this retarded

17:45 licoresse: how was that :keys destructuring again?

17:47 technomancy: slyphon: happens to everyone at some point

17:47 slyphon: yeah, must be early-onset stupidity

17:48 * licoresse found it

18:02 Raynes: ,(doc "blah")

18:02 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Symbol

18:02 Raynes: Is there a way to turn a string into what doc can take?

18:02 ,(doc (symbol "blah")) ; obviously doesn't work.

18:02 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol

18:06 Licenser: Raynes: find-doc

18:06 ,(find-doc "bla")

18:06 clojurebot: ------------------------- hiredman.clojurebot.core/inits ([[f & r :as c]]) again I blame Chouser ------------------------- hiredman.clojurebot.factoids/inits ([[f & r :as c]]) again I blame Chouser

18:07 Licenser: what?

18:07 clojurebot: what is short for ,(doc ...)

18:07 defn: hi all

18:07 Raynes: find-doc wont work in this situation.

18:07 Because it can return more than one result.

18:09 Licenser: kk

18:09 slyphon: it would be nice if there were a way of having some "standard" group of things that you want to use in all your namespaces

18:10 Raynes: Hrm.

18:10 slyphon: like clojure.contrib.logging

18:11 technomancy: slyphon: http://onclojure.com/2010/02/17/managing-namespaces/

18:11 slyphon: ooh

18:11 technomancy: ty

18:11 technomancy: it's a little rough, but looks promising

18:11 I've wanted something like that too

18:12 slyphon: yah, i was thinking of setting up a macro i can just call by default in each namespace

18:12 that would live in one location

18:17 Raynes: Eh, looks like hiredman write a cryptic macro to work around this little issue.

18:18 slyphon: Raynes: link?

18:19 Raynes: http://github.com/hiredman/clojurebot/blob/master/src/hiredman/sandbox.clj#L93

18:19 * slyphon blinks

18:20 Raynes: Yeah. I miss the old doc that took a string.

18:20 It should have been moved to doc-string or something.

18:20 slyphon: you could probalby use (eval) for that no?

18:20 or write a macro?

18:21 Licenser: Raynes: thanks for adding the additional functions :)

18:21 slyphon: nah, you'd need eval i think

18:21 Raynes: Licenser: Why isn't doc whitelistable again?

18:22 Licenser: hmm most likely because I forgot it

18:22 Raynes: It doesn't seem to work even if you whitelist it.

18:23 Licenser: Nope, just confirmed. It doesn't allow it even if it's whitelisted.

18:24 Licenser: Raynes: ah because it is an macro then

18:24 ,(macroexpand '(doc "doc"))

18:24 clojurebot: (let* [m__1734__auto__ (clojure.core/meta (clojure.core/resolve (quote "doc"))) al__1735__auto__ (:arglists m__1734__auto__) docstring__1736__auto__ (:doc m__1734__auto__)] (if m__1734__auto__ (.replaceAll (clojure.core/str al__1735__auto__ "; " docstring__1736__auto__) "\\s+" " ") (clojure.core/-> hiredman.clojurebot.code-lookup/contrib :vars ((clojure.core/partial clojure.core/filter (clojure.core/fn [a__1737__auto__] (c

18:24 Licenser: oi I'm not sure if whitelisting resolve is good,

18:24 Raynes: Licenser: That's hiredman's special doc. Doesn't count.

18:24 Licenser: or meta

18:24 ah okay

18:24 Raynes: Licenser: Try doing it in your own REPL.

18:25 Licenser: because the function si called print-doc?

18:25 Raynes: Apparently so. :o

18:25 Licenser: heh

18:25 * Licenser has to idle a bit brother is coming over

18:26 Raynes: Kay.

18:26 defn: any fun ideas for obfuscated clojure?

18:26 Raynes: Lot's of commas.

18:26 defn: :)

18:27 Raynes: Licenser: I'll add print-doc to the whitelist later.

18:28 defn: ,`@#'f

18:28 clojurebot: (clojure.core/deref (var sandbox/f))

18:30 defn: ,`~*

18:30 clojurebot: #<core$_STAR___4526 clojure.core$_STAR___4526@1ab5fd5>

18:31 defn: ,`~'@*

18:31 clojurebot: (clojure.core/deref *)

18:31 defn: that could be ugly

18:35 licoresse: How can I create an array of floats in Clojure? Tried (into-array Float [10.0 20.0])

18:36 Yes, I'm a java noob

18:36 defn: ,(doc float-array)

18:36 clojurebot: "([size-or-seq] [size init-val-or-seq]); Creates an array of floats"

18:37 licoresse: thanks defn

18:37 hiredman: hiredman.clojurebot.code-lookup/contrib is broken

18:37 :/

18:37 defn: licoresse: I think there's a way to use into-array like you're doing above, but it needs to be Float/something for the type IIRC

18:37 hiredman: replaca_: the vars stuff in the json is empty

18:38 * licoresse kids waking up

18:39 defn: licoresse: you could do this:

18:39 ,(into-array (map float [1.0 2.0 3.0]))

18:39 clojurebot: #<Float[] [Ljava.lang.Float;@129f6e7>

18:42 licoresse: defn: that won't do it for BasicStroke

18:42 the float-array works swell

18:44 defn: (floats (float-array [1 2 3]))

18:44 ,(floats (float-array [1 2 3]))

18:44 clojurebot: #<float[] [F@8e4ea6>

18:44 defn: licoresse: i was curious -- that's from chouser awhile back

18:45 licoresse: why cast it to floats first?

18:46 (float-array [1 2 3])

18:46 ,(float-array [1 2 3])

18:46 clojurebot: #<float[] [F@fb241d>

18:49 hiredman: floats is for if you are using let in an inner loop and want to avoid array reflection

18:53 licoresse: I see

19:01 Raynes: ,(let [x 3] (let [x (+ x 5)] (println x)))

19:01 clojurebot: 8

19:02 Raynes: That isn't cute.

19:06 alexyk: Raynes: did you expect 2010?

19:07 Raynes: btw, rename clojure-casual to clojure-cajual

19:07 ...snd serve some cajun food

19:07 there

19:07 Raynes: alexyk: No, I expected it to be like Haskell and not allow me to do that. :p

19:07 And, psykotic didn't like the idea of cajual.

19:09 hiredman: ,(let [x 3 x (+ x 5)] x)

19:09 clojurebot: 8

19:09 alexyk: so, nested x is not rebinding the outer, it's shadowing it, so all is cool, no?

19:09 and hiredman actually redefines it

19:09 so what, it's expected

19:10 if Haskell doesn't like it, -- deal with it, Haskell!

19:10 Raynes: I didn't expect it. Haskell assumptions.

19:10 slyphon: has 1.2 been released yet?

19:10 alexyk: "Clojure: rebinding Haskell's mama"

19:10 joshua-choi: slyphon: I don't think so

19:10 slyphon: bummer

19:11 * joshua-choi is very happy that Rich Hickey added slurping map parameters to functions

19:11 alexyk: how do you slurp now?

19:12 joshua-choi: I mean, like (fn [first-arg & rest-args] ...)

19:12 alexyk: ah ok

19:12 joshua-choi: http://github.com/richhickey/clojure/commit/29389970bcd41998359681d9a4a20ee391a1e07c

19:14 alexyk: nice

19:14 joshua-choi: Question: how can you check if an object can turn into a sequence, i.e. if (seq x) will not throw an Exception?

19:15 alexyk: Yeah, that will have ramifications. It seems to me that proper named arguments are now possible in the vector arg itself

19:15 chouser: there's not a particularly good way I guess because it's considered an inappropriate question.

19:16 joshua-choi: Well, there's ifn?.

19:16 I want something like ifn? for sequences for a precondition.

19:17 chouser: a precondition will throw if it fails anyway, right? so why not just use 'seq'?

19:17 joshua-choi: Oh, right

19:17 Of course

19:22 Well, actually, I don't want that

19:23 I'd like specifically an assertion error thrown, like any other precondition. If I just use {:pre #{(seq x)}}, then it won't give as useful of a message

19:24 But is there really no other way than to do (isa? (type x) clojure.lang.Seqable)?

19:27 chouser: well, seq works on Strings but String is final and doesn't implement Seqable

19:28 there's a 'seqable?' in contrib somewhere, but it has always struck me as a bit fragile.

19:30 slyphon: wow

19:30 the namespace stuff is hairy

19:31 i'd love to use something like http://code.google.com/p/clj-nstools/ but my project is using clojure-1.1

19:32 joshua-choi: chouser: I didn't know that String didn't implement Seqable. Although in retrospect that's obvious. clojure.contrib.core/seqable? would be what I want, although its source code does seem to be fragile. I wish there was a better way.

19:54 Is there a core/contrib function that tests if one integer divides another? Yeah, I know I can just do (zero? (mod x y))...

19:55 programble: (defn divisible [x y] (zero? (mod x y)))

19:56 joshua-choi: programble: Sorry, I meant, "Is there a standard function in clojure.core or .contrib?"

19:57 programble: ...

19:57 (defn divisible [x y] (zero? (mod x y)))

20:02 _ato: I doubt it

20:02 ag90: (mod x 0) will kill that one. Need a check for that too.

20:11 alexyk: liebke: is there any clustering in incanter, like k-means?

20:14 defn: liebke: I'm having some issues getting charts to display on Ubuntu 9.10

20:14 liebke: alexyk: not yet

20:14 defn: what's the error?

20:15 alexyk: kk

20:18 defn: liebke: the window comes up, but it's just empty -- the same code works on OSX

20:20 liebke: defn: hmm, no idea

20:20 defn: very weird

20:21 liebke: true

20:21 defn: sun-awt-x11-XFramePeer is the classname of the window

20:21 I could give you the #<ChartFrame...> in a PM if you'd like

20:28 robink: Do I need to call Java's sin function to caluclate a sine in clojure?

20:48 joshua-choi: I'm wondering: is there a particular reason why there are no def-, defmacro-, defmulti-, or deftype- macros in clojure.core? Is hiding vars looked down upon?

20:59 defn: I'm trying to sort a vector of maps by a key in each map

20:59 slyphon: sort-by ?

21:00 defn: [{:foo 4 :bar 8} {:foo 7 :bar 5}] => (when sorting on :bar) => [{:foo 7 :bar 5}...]

21:01 slyphon: how would i use sort-by there?

21:01 slyphon: (sort-by :bar [{:foo 1 :bar 7} {:foo 2 :bar 3}])

21:01 defn: hmm, i dont think that works on the vector

21:01 slyphon: ,(sort-by :bar [{:foo 1 :bar 7} {:foo 2 :bar 3}])

21:01 clojurebot: ({:foo 2, :bar 3} {:foo 1, :bar 7})

21:01 defn: huh, nevermind

21:06 thanks slyphon

21:06 slyphon: sure

21:10 robink: OK, so it's in clojure-contrib

21:10 How do I force clojure to include Clojure-contrib's set of functions?

21:10 It's installed in /opt/local/share/clojure/lib, but clojure isn't loading it upon startup.

21:11 /opt/local/share/clojure/lib/clojure.jar is present in that location, but it won't touch other .jars in the same directory.

21:11 slyphon: you have to add them to your classpath?

21:12 robink: slyphon: Tried that.

21:12 slyphon: you have to explicitly require those libraries

21:12 import names from them into your namespace

21:12 robink: (ns user (:require [clojure.contrib.generic.math-functions :as generic))?

21:12 lithpr: robink: to answer this, and all subsequent similar questions, you'll need to learn about namespaces (use require refer import)

21:13 as you apparently have :)

21:13 robink: Says it can't find clojure/contrib/generic/math_functions__init.class or clojure/contrib/generic/math_functions.clj

21:13 lithpr: I'll learn more about namespaces.

21:15 lithpr: What's a good reference?

21:17 lithpr: uhm, the most concise summary i've found was in labrepl

21:17 robink: lithpr: Thanks

21:18 lithpr: In the labrepl source?

21:19 lithpr: when you start labrepl it uses jetty to serve the lessons from localhost

21:19 robink: lithpr: Ah, OK

21:19 lithpr: so that's a lot of work to get the info

21:19 robink: Indeed

21:20 lithpr: (ns user (:use clojure.contrib.generic.math-functions)) returns without objection in my set up

21:21 robink: lithpr: Doesn't work for me, something's wrong with my setup.

21:21 lithpr: Clojure was very recently added to MacPorts, they may not have everything set up the way it should be.

21:21 lithpr: oic

21:22 robink: Lemme try from Gentoo

21:22 Returns in Gentoo :(

21:23 and the library location is less sane in Gentoo

21:23 lithpr: ubuntu here, so i'm no help with the mac

21:24 robink: I explicitly set CLASSPATH to point to the clojure-contrib.jar and it fails

21:24 lithpr: never realized macs used ports... its bsd though...

21:24 robink: Yeah, essentially

21:25 MacPorts is a "distro" for OSX, it's not really part of the OS.

21:25 I could install Gentoo Prefix (which I may do, if I can't hammer this one out)

21:25 Advantage of MacPorts is that it relies on the system libc so there's less memory usage etc

21:25 Gentoo Prefix pulls the whole userland in

21:26 lithpr: neat

21:26 robink: I s'pose

21:27 lithpr: every single other member of the Pittsburgh clojure meetup had a mac...

21:27 robink: Hah

21:27 I was the only person at the Seajure meeting with a Mac.

21:27 Well, Brian had one, but he didn't take it out IIRC.

21:29 I should've attended the first Seajure meeting.

21:30 There had to have been someone with a mac there.

21:31 lithpr: have you tried using a lein based install?

21:31 defn: woo hoo! pretty graphs in incanter. this is starting to get really fun now :)

21:32 lithpr: defn: yeah, made one yesterday going through the labrepl labs. never played with it before. pretty slick...

21:33 also never realized that the letter p is second only to s as the first letter of words in english :)

21:33 defn: hehe

21:34 sattvik: robink: Are you still having the problem with Clojure-contrib?

21:41 lithpr: robink: you might consider using lein & swank clojure. If sets up a clojure and clojure contrib (and whatever) on a per project basis, and handles the classpath issues. never really appreciated the fact that i haven't experienced classpath hell since moving to clojure...

21:47 phren0logy: is anybody else having problems connecting to the swank server that's supposed to be started by LabREPL?

21:47 lithpr: i didn't have a problem with it

21:48 are you in the right pwd when you start it?

21:50 fyi, in emacs, once you are in the right dir and M-x inferior-lisp, you can subsequently M-x slime-connect, and use it from slime

21:50 i know nothing of inferior-lisp mode, but i'm loving the slime-mode buffer/slime-repl clojure combo

21:50 phren0logy: yeah, I start it from the labrepl directory with script/swank (on ox X)

21:50 er, os x

21:51 lithpr: are you getting an error?

21:51 phren0logy: it fires up the web server, but I get an error when I M-x slime-connect

21:51 saying there's nothing on socket 4005

21:51 and I can connect when I fire up swank from incanter

21:52 so I'm not sure what's up

21:53 lithpr: huh. is happy here.

21:53 phren0logy: is there any way to force lein to re-download all the dependencies?

21:54 It starts, and I get the web server and I repl prompt in the terminal, just no swank server

21:54 what platform are you on, and are you using the most recent version of labrepl? One of the updates seems to have broken mine, unless that was just coincidence.

21:55 lithpr: ubuntu 9.10, labrepl as of two days ago.

21:56 not sure where i'd find a version number

21:56 phren0logy: Well, I don't want you to break yours, but if you try git pull let me know if it screws up.

21:56 I get: Debugger entered--Lisp error: (file-error "make client process failed" "Connection refused" :name "SLIME Lisp" :buffer nil :host "" :service 4005)

21:57 To get a version, try "git log" from the labrepl directory

21:57 (if you cloned the git repo)

21:58 lithpr: yeah, i cheated. i just downloaded it as a tar.gz. kinda a hg man...

21:58 phren0logy: the most recent commit's SHA1 starts with db97156, with the commit message "reorg README"

21:58 Ah. Ok, cool. Thanks anyway.

22:00 lithpr: "relevance-labrepl-e978d2e"

22:02 phren0logy: lithpr: OK, cool, that seems to be before a change to the startup script

22:02 I'll roll mine back

22:06 lithpr: That fixed it, thanks.

22:07 I'm sure hg does pretty much the same thing, but "git checkout e978d2e" took me right to it. DVCS is awesome.

22:13 lithpr: no git hatred here, just ignorance.

22:13 seems like clojure, like ruby, prefers git, so i'm going to have to improve that situation

22:14 the guys on FLOSS weekly seem to be enthusiastic about it too

22:17 phren0logy: lithpr: I really haven't picked a side, it's just that all the cools stuff is on github. At a glance, hg actually seems much more humane and sensible.

22:20 lithpr: phren0logy: is it working for you now?

22:22 phren0logy: lithpr: yes, it's working great

22:23 lithpr: cool

22:24 robink: lithpr: How can I examine the contents of the Java CLASSPATH to see if Java can get at clojure-contrib?

22:24 lithpr: I don't know if this is a problem with Java, MacPorts or somehow my build of Clojure.

22:25 somnium: (System/getProperty "java.class.path")

22:26 robink: somnium: Thanks

22:26 somnium: Can I examine Clojure jars with Java?

22:26 somnium: robink: not sure what you mean

22:27 robink: somnium: Maybe I don't either

22:27 somnium: OK, so the only thing in the CLASSPATH is clojure.jar

22:27 That's a start

22:27 phren0logy: robink: I have been using homebrew, and I installed leiningen with it. It has been working very well for me. Just something to consider if MacPorts is giving you trouble.

22:27 robink: phren0logy: OK, I will

22:28 lithpr: phren0logy: seconded

22:28 robink: phren0logy: Yeah, even when I mention clojure-contrib in the CLASSPATH environment variable, it doesn't show in Java's runtime classpath.

22:29 phren0logy: With leiningen, I haven't had to worry about classpaths nearly as much. Which is great, becuase that always seems to be a headache.

22:29 bb_oz: robink: you could start clojure with -cp

22:31 java -cp $JLINE_JAR:$CLOJURE_JAR:$CLOJURE_CONTRIB_JAR:$MORE_CLASSES jline.ConsoleRunner clojure.main

22:32 Mec: Has anyone by chance made a JTree out of nested maps?

22:34 lithpr: Mec, i hope someone gives you a magic link, because i can only think of about a 1000 nifty things to do with that off hand...

22:34 Mec: I know right, I'll deffinitly have to publish it if I dont kill myself first

22:34 lithpr: that would be worth the effort

22:46 Mec: Assuming every key is a node in the tree, how would you represent the leaf key values (if at all)

22:49 lithpr: you'ld essentially need to decide whether the key value only serves to host the structure, or have it do double duty as a label

22:50 is my knee-jerk response

22:50 Mec: I was going to have it be label as well, else where would you put the key-label links

22:52 robink: bb_oz: Thanks

22:54 lithpr: well, {:foo [[:label "bar" :other-stuff "baz"] {:biz ...

22:55 again, i'm not really thinking deeply here, and it's thought-worthy...

22:56 robink: OK, fixed it, but I have to call clojure from Java per bb_oz' suggestion.

22:56 lithpr: robink: excellent. glad to hear it

22:56 robink: lithpr: I'd still like to just be able to fire up clojure.

22:56 Mec: can you assosciate metadata with just a key inside a map

22:56 robink: Oh, clj is a script

22:56 lithpr: Mec.. ooh, that's nice

22:57 keeps it generic

22:57 the structure you're modeling with the JTree i mean

22:57 Mec: like {(with-meta :foo {:label "bar" :other-stuff "baz"}) {next-level-of-tree}}

22:58 robink: Is it a bad thing to pull in clojure-contrib every time?

22:58 clj looks in ~/.clojure and adds anything there to the classpath.

22:59 Mec: is it possible to do what i typed?

22:59 lithpr: robink: there are two kinds of people- those that mess with classpaths and those that tool them. I was of the former, and it gave me a lot of advantagesrelative to my peers. I am now the later, and probably worse for it :)

23:00 robink: lithpr: Heh, it seems to me to be better to tool your classpath, but I don't know jack about Java or handling deps in OO languages.

23:01 lithpr: mec, i have not ever actually used metadata, but the usecase for it that rich talked about is exactly the one you have here

23:01 like exactly, that is metadata to the structure

23:01 Mec: ya

23:02 and that why you can even embed your own listeners

23:02 but can you add meta to a keyword

23:02 lithpr: so i don't know if your code is syntacticly perfect, but conceptually it is definitely spot on

23:02 Mec: and the answer is nope

23:02 which really sucks

23:03 lithpr: you can add it to a symbol

23:03 but not a keyword?

23:03 Mec: can you add it to a symbol or just the value the symbol is representing

23:04 ,(with-meta 'test {:test true})

23:04 clojurebot: test

23:04 Mec: ,(meta (with-meta 'test {:test true}))

23:04 clojurebot: {:test true}

23:04 Mec: \

23:04 ,(with-meta :test {:test true})

23:04 clojurebot: java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.IObj

23:05 brweber2: does anyone know if there is an akka bridge or equivalent erlang style actor library for clojure?

23:06 Mec: so maybe instead of maps, the structure can be vectors with metadata

23:08 robink: Clojure docs have you getting pi via (. Math PI). Is this optimal?

23:08 It seems to be relying on Java. I still haven't figured out Java calls.

23:08 Mec: ,Math/PI

23:08 clojurebot: 3.141592653589793

23:09 Mec: shorthand for static members

23:09 robink: Mec: Thanks.

23:11 * slyphon tries to figure out if it's totally insane to write a macro that creates macros

23:14 Mec: ,#^{:label "Root"} [#^{:label "brach1"} 'leaf?]

23:14 clojurebot: [leaf?]

23:14 Mec: That doesn't look too bad, but what should be used to represent leaf nodes

23:17 slyphon: jeez

23:17 the fact that 'defmacro' is a fn just blows my mind

23:18 Mec: a macro is just a function with a macro flag in its metadata

23:21 * somnium finds nested syntax quotes extremely hard to read/write

23:21 slyphon: yeah, i mean, it has to be a function, but at some level, that's just more meta than i can easily comprehend

23:22 Mec: most simply a macro is just a function that doesnt evaluate its args

23:25 * slyphon tries to wrap his mind around what exactly the ` does

23:32 Mec: I guess it doesnt matter what the leaf node actually is since all we want is it's metadata

23:43 bah meta cant be applied to string either :x

23:47 which representation looks better, or is there another I havnt considered? http://gist.github.com/345693

23:49 ,(meta (with-meta (keyword "test") {:test true}))

23:49 clojurebot: java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.IObj

23:49 * Mec cries

23:51 somnium: yeah keywords are interned singletons :/, Ive settled on using a wrapper type for strings/numbers for the same problem, though its not very satisfying

23:52 Mec: symbols will work right?

23:52 _ato: yes

23:53 Mec: ,(meta (with-meta (symbol "test") {:test true}))

23:53 clojurebot: {:test true}

23:53 Mec: symbols it is

23:54 http://gist.github.com/345693

Logging service provided by n01se.net