#clojure log - Apr 14 2010

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

0:15 technomancy: hugod: what about that function specifically?

0:15 just see that it makes sense?

0:17 hugod: ok, slime-autodoc works for me in slime head without the patch

0:18 technomancy: so it was just a temporary bug in an older slime head?

0:18 the hackiness that's evident when looking at slime code makes me feel a little better about the hackiness of swank-clojure

0:20 hugod: gotta take off; will sync up with you later.

0:20 hugod: technomancy: I'm making mistakes - time to sleep - it's hanging for me

0:20 technomancy: a fresh brain often helps =)

0:20 bye

0:57 vIkSiT: hello all

0:58 i was wondering - on a normal emacs-slime-clojure installation - how do you send a buffer where i'm writing code, to the repl for execution?

0:58 i'm using aquamacs, but C-c C-k shows up as "not bound" for me.

0:58 tomoj: what mode are you in

0:59 i.e. what's in parentheses in the modeline near the bottom

1:00 polypus: vIkSiT: try M-x slime-eval-buffer

1:01 vIkSiT: tomoj, ah - i've got a repl running in a split screen mode. the bottom contains [[(REPL)]] and the top has a clj file open which says [[(fundamental)]]

1:01 hiredman: should be clojure-mode

1:01 or just clojuire

1:02 tomoj: did you install the clojure emacs stuff before or after opening the clj file?

1:02 vIkSiT: oh got it. clojure mode seems to send CcCk to the REPL.

1:02 tomoj, ah, what i did was - typed in (println "foo") and then saved it as /tmp/foo.clj

1:03 tomoj: try C-x C-f /tmp/bar.clj

1:03 if that buffer opens in fundamental mode, something's wrong with your installation

1:03 vIkSiT: looks like just M-xc lojure-mode will enable the mode, and I can then use Cc Ck

1:03 tomoj, nope, its working now, I overlooked the clojure-mode!

1:04 tomoj: clj files should automatically turn clojure-mode on, though

1:04 vIkSiT: tomoj, indeed. just looking at me .emacs

1:04 my*

1:05 does anyone here use clojure for concurrency/parallel programming btw?

1:06 (in the sense, they switched to it take advantage of agents, et al)

1:07 hiredman: omg

1:07 incanter.latex

1:09 vIkSiT: sounds cool

2:49 zkim: ,(conj [1 2] 3)

2:49 clojurebot: [1 2 3]

3:51 LauJensen: Morning crew

4:11 vIkSiT: hmm, I'm running clojure-mode on a file named 2.clj in emacs - but I don't seem to be getting auto indentation anywhere

4:11 any ideas on what I can check?

4:14 LauJensen: (global-set-key "\r" 'newline-and-indent)

4:17 @ vIkSiT

4:17 vIkSiT: LauJensen, ah this in my .emacs file?

4:17 LauJensen: Yup - Put it in there and eval the expression

4:20 vIkSiT: LauJensen, awesome, thanks!

4:22 LauJensen: np :)

4:22 npoektop: how to compare sets by their content? i have #{{:id 1} {:id 2}} and #{id1 id2}, (= for them should say true.

4:26 LauJensen: npoektop: Why should it be true?

4:27 You could do something like

4:27 ,(map = (vals {:id1 1 :id2 2}) #{1 2})

4:27 clojurebot: (true true)

4:27 LauJensen: And that would make a little more sense, but you compare a set of hashmaps to a set of symbols should not be true

4:30 npoektop: LauJensen, i'd like to dereference those symbols so this comparison would give true

4:31 LauJensen: Then you need to convert them. You want to compare a keyword and an integer, in a concatenated form, to a symbol.

4:32 npoektop: LauJensen, ok. How to convert them?

4:34 LauJensen, id1 = {:id 1}, id2 = {:id 2}. How to compare #{id1 id2} and #{{:id 1} {:id 2}}?

4:34 LauJensen: Is the actual comparison (= 2 2) or (= 'id2 'id2) ?

4:34 does {:id 1} => id1 or 1

4:36 @ npoektop

4:38 npoektop: LauJensen, i do not understand what you mean(

4:38 LauJensen: I'm just trying to understand your data

4:39 Is this what you're trying to do

4:39 ,(= (set (mapcat vals #{{:id 1} {:id 2}})) #{1 2})

4:39 clojurebot: true

4:39 npoektop: ,(let [id1 {:id 1}] (= id1 {:id 1}))

4:39 clojurebot: true

4:42 npoektop: LauJensen, ok, another way. I have a function profiles-by-ids wich returns a vector of maps. I want to write a test that would check if '(id1 id2) = '({:id 1} {:id 2}). I thought coercing to set would work.

4:43 LauJensen: Ok, so you have a vector of maps ala {:id 1} {:id 2} and you want some way of testing if an id is represented somewhere in that vector?

4:44 (let [id2 {:id 2}] (contains? #{{:id 1} {:id 2} {:id 3}} id2))

4:44 ...true

4:44 :)

4:46 npoektop: LauJensen, ok. But what if there are hundreds of ids? (contains? ... id1) ... (contains? ... idn)?

4:47 LauJensen: Then perhaps you'd want to filter out those ids

4:47 ,(filter #{{:id 2}} #{{:id 1} {:id 2} {:id 3}})

4:47 clojurebot: ({:id 2})

4:47 LauJensen: The predicate in that case, is just a set containing the relevant keys

4:53 npoektop: LauJensen, what should i do now with that vector?

4:53 ,(let [id1 {:id 1} id2 {:id 2}] (filter #{id1 id2} #{{:id 1} {:id 2} {:id 3}}))

4:53 clojurebot: ({:id 1} {:id 2})

4:53 npoektop: s/vector/list. count it's members?

4:56 LauJensen: Factor it out into a predicate

4:56 (defn contains-ids? [ids coll] (not (empty? (filter ids coll))))

4:56 So if there are no hits, the filter returns empty (true) which we reverse with not.

5:01 npoektop: LauJensen, i don't know why it didn't work ten minutes ago. I tryed smth like this: (= (set (profiles-by-ids [...]) (set (list id1 id2)))

5:01 now it works

5:02 LauJensen: Try it with real data on Clojurebot

5:04 npoektop: ,(let [id1 {:id 1} id2 {:id 2}] (= (set '({:id 1} {:id 2})) (set (list id1 id2))))

5:04 clojurebot: true

5:07 npoektop: LauJensen, my question was a little tangled, i know) thank you for help

5:09 LauJensen: npoektop: Ah ok. This will fail if the number of arguments differ, I thought you needed to avoid that, ie

5:09 ,(let [id1 {:id 1} id2 {:id 2} id3 {:id 3}] (= (set '({:id 1} {:id 2})) (set (list id1 id2 id3))))

5:09 clojurebot: false

5:09 LauJensen: But I'm glad you worked it out

5:15 npoektop: is there a way to make a variable global, but for one file?

5:15 LauJensen: The file concept is tricky, think in namespaces

5:16 npoektop: ok. how to make non-public def?

5:17 LauJensen: ,doc defn-

5:17 clojurebot: java.lang.Exception: Can't take value of a macro: #'clojure.core/doc

5:17 LauJensen: ,(doc defn-)

5:17 clojurebot: "([name & decls]); same as defn, yielding non-public def"

5:18 npoektop: i'd like to def a variable

5:21 hoeck: (def #^{:private true} foo 10)

5:21 or (clojure.contrib.def/defvar- foo 100)

5:22 LauJensen: Yea I was just about to say, check out contrib.def

5:37 _invis: guys could you help me to write this Graphics2D g2 = (Graphics2D) img.getGraphics(); on clojure in let ?

5:39 raek: (let [g2 (.getGraphics img)] (do-stuff g2))

5:41 _invis: rhickey does some graphics in the example in the end of this talk: http://clojure.blip.tv/file/812787/

5:42 _invis: thank you

5:43 raek: (the "ants example" is available here: http://groups.google.com/group/clojure/files look for ants.clj)

5:52 LauJensen: Also my blog has more than a few examples of graphics sims

6:05 npoektop: hoeck, LauJensen, thank you.

6:06 hoeck: npoektop: np :)

6:21 vegai: do the authors of The Joy of Clojure visit here?

6:21 LauJensen: they practically live here

6:21 vegai: ah :)

6:22 I was about to ask where to send corrections, but now I see that every single page has a like to a forum...

6:22 like/link

6:39 LauJensen: For the european (or travel happy) people in here: http://www.bestinclass.dk/index.php/2010/04/clojure-meets-the-european-industry/

6:54 esj: LauJensen: nice choice - good beer.

6:54 LauJensen: esj: You should talk to cgrand, that was his argument as well :)

6:55 esj: i tried to sell him on Cambridge, but no dice.

8:12 Raynes: LauJensen: European training sessions huh? :p

8:13 LauJensen: Thats right - You flying in ?

8:13 Raynes: LauJensen: For 1200€ sessions? I think not. :p

8:13 LauJensen: I'll throw in a free cheese burger :)

8:14 Raynes: I'm sold.

8:14 ;p

8:15 LauJensen: Perfect

8:15 Raynes: I think the Rubylearning Clojure course guys like me.

8:16 LauJensen: Why wouldnt they ?

8:16 Raynes: Just sayin'. Stuff like this: http://twitter.com/IndianGuru/statuses/12158700306

8:17 Sure know how to make a fella' feel warm and fuzzy inside. :p

8:17 LauJensen: AWwwww :)

8:18 AWizzArd: Is there already an idiomatic way to serialize (print + read) deftypes?

8:18 Raynes: That was after I made the comment that I'm a "teacher undercover as a student".

8:20 AWizzArd: Best way is to add a print-dup method for user defined types?

8:36 chouser: You implemented the printing for deftypes yes?

8:41 Raynes: We need a Clojure window manager. ._.

8:41 I want a window manager I can configure in Clojure.

8:51 LeNsTR: =)

8:52 chouser: Raynes: yes. abrooks is working on it. :-)

8:52 AWizzArd: yeah, the current (unreadable) format.

8:55 AWizzArd: chouser: who calls print-deftype in http://github.com/richhickey/clojure/blob/master/src/clj/clojure/core_deftype.clj#L301 ?

8:55 in core_print.clj i didn’t find the caller

8:57 rhickey: name game again

8:57 AWizzArd: uh oh ^_^

8:58 rhickey: I am trying to support stable names for deftype/defrecord even when used dynamically, using the same technique that definterface does

8:58 this means that it will be useful to auto-import the class name, and thus would conflict with the current factory fns

8:58 AWizzArd: rhickey: you wrote about stable nam.. ah, this is what I wanted to ask

8:59 rhickey: in addition, there *may* be a facility for providing bodies for the factory fn(s), if so these wil end up as static method(s) of the generated class

8:59 AWizzArd: Stable names means: (defrecord Foo [a b c]), (class (Foo 10 20 30)) <--- will keep the same name even after restarting JVM?

9:00 rhickey: thus we need name for static factory method, and possble wrapper fn for same

9:00 I like Foo/create

9:01 AWizzArd: yes, better than make-instance

9:01 rhickey: not sure about wrapper fn, could be create-Foo

9:02 AWizzArd: In what situations would the wrapper be used?

9:04 rhickey: AWizzArd: hopefully most - it gives you some encapsulation of the host-iness of it. Also would be a first class fn (e.g. mappable)

9:04 AWizzArd: Foo/create and create-Foo sound good and clear.

9:05 Instead of create maybe "new" or "make" could be used, but I like create more.

9:05 rhickey: "new" can't be used as static method name - Java keyword

9:05 AWizzArd: ok

9:05 liwp: assuming we want to use the same name in both cases, new is out of the question

9:06 and Foo.make sounds weird in Java land

9:06 so I too would vote for create

9:06 AWizzArd: yes

9:07 Also interesting is this new question from the Wiki: "record equality: basic map rules, or incorporate type?".

9:08 rhickey: AWizzArd: one question at a time :)

9:08 jfields: what's the easiest way to create a seq of lines from a file?

9:08 AWizzArd: io/read-lines returns a lazy seq

9:09 jfields: This means your jvm memory will not explode even for 10gb files, but it also means that you have to completely consume the file to have it closed again.

9:09 jfields: AWizzArd, thanks.

9:10 rhickey: jfields: or you can use with-open and line-seq for more control

9:10 AWizzArd: make, create, instantiate, create!, produce... "create" seems to be the best option

9:12 gen / generate

9:13 chouser: AWizzArd: 5 lines before that, in the deftype macro. (defmethod print-method ~tag ...)

9:14 AWizzArd: create seems nice for the static method name, but I'm tending to agree with whoever it was that suggested against generating vars with computed names.

9:14 sorry, that wasn't specifically for AWizzArd

9:15 (defrecord Foo [a b]) (create Foo 1 2) (create-rec Foo :b 2, :a 1)

9:15 rhickey: chouser: well, we were generating computed names with the factory fn before, with conflict now on class name

9:15 AWizzArd: chouser: okay, thanks for the hint with the 5 lines in the deftype macro.

9:16 rhickey: (record Foo ...) means records are more verbose than new sugar

9:16 and don't have single mappable fn

9:16 will we get a lot of (comp record Foo) ?

9:16 chouser: AWizzArd: It's ((var print-deftype) ...) to allow the macro expansion to call a private fn

9:16 rhickey: Hm, I suppose. But Foo-create feels like such a hack

9:16 AWizzArd: I think for such an important mechanism like defrecord it is okay to auto gen Foo/create and create-Foo

9:17 rhickey: chouser: Foo/create works tough?

9:17 chouser: :-) yeah

9:17 rhickey: hrm

9:17 * chouser starts to feel a little silly

9:18 chouser: Foo is a thing that Foo/create is a part of

9:18 rhickey: there still might be (record Foo k1 v1 k2 v2 ...)

9:18 chouser: You can ask Foo for its methods and find create. This doesn't feel like a hack.

9:19 rhickey: but any data-driven (maker Tag ...) is going to have overhead vs a dedicated fn

9:19 chouser: But Foo-create is not a part of Foo, it's this other thing that was produced as a side-effect of defining the type.

9:19 rhickey: chouser: it would never be F00-create, more like create-Foo

9:19 AWizzArd: How would we like to create instances of Foos? (Foo/create 1 2 3) or (create-Foo 1 2 3) or (create-rec Foo 1 2 3)?

9:20 rhickey: AWizzArd: are you just restating the question?

9:20 chouser: so a separate create fn will be: slower, compilcate usage of ->, probably produce a lots of (partial create Foo), ... all in exchange for "feeling" a little less like a hack.

9:20 rhickey: Foo/create will be there, is hosty, and non-mappable (at present)

9:21 create Tag ... has overhead, needs comp/partial to map

9:22 also, there will still need to be a separate keyvals factory

9:22 in my mind that was (record Foo ...)

9:23 chouser: they might as well have the same shape, right? create-Foo and record-Foo ?

9:23 or (create Foo v1 v2) and (record Foo k1 v1 k2 v2)

9:24 there's got to be some third way

9:24 rhickey: you have to also consider what Foo designates in (create Foo ...)

9:25 Foo will be a class name

9:25 thus as an ordinary arg will designate a class

9:26 chouser: Is the only strike against just using Foo/create that it's not a proper function?

9:26 rhickey: chouser: and hosty

9:27 chouser: I can easily pretend its namespacy instead

9:27 wthidden: rhickey: Was/is there a problem with the way CLOS does this sort of thing that Clojure want's to avoid?

9:28 rhickey: note that falling out of this will be the ability to define deftypes of all static methods

9:28 AWizzArd: wthidden: the proposed way is more like CL structs I find

9:29 hoeck: what about generating a Foo/create static method and a Foo/create static field, where the latter contians the wrapper fn?

9:31 wthidden: AWizzard: now that I think more about it I agree its closer to CL structs.

9:31 rhickey: wthidden: CLOS does the data-driven approach, will not compete perf-wise with direct fns

9:31 hoeck: sounds confusing

9:32 wthidden: rhickey: Ah yes, the seventeen levels of indirection before we actually do some work. Now I rememeber some of the CLOS pain.

9:34 AWizzArd: So far it sounds that for technical reasons create-foo has advantages over (create-rec Foo ...).

9:34 wthidden: well if I had my druthers I'd go more towards CL structs way of doing things, but then I'm a lisp weeny at heart.

9:35 kzar: So I built Compojure and put the compojure.jar inside ~/.swank-clojure/ directory, restarted Clojure but (use 'compojure) isn't working. What should I do?

9:37 rhickey: wthidden: I think the data-driven approach is not the best foundation - since each ctor is really unique code, forcing them to live behind a generic data driven interface means you can't ever reach that code directly, whereas if you have the direct fn, you can always build a generic data-driven thingy

9:39 npoektop: if i do (assoc map key val), it returns a new map. Is there a way to destructively assoc?

9:39 chouser: npoektop: not really -- why do you think you want to?

9:40 npoektop: chouser, i want to insert a new key/val pair into map

9:40 into existing map

9:40 chouser: npoektop: part of the promise of Clojure's persistent maps is that if you have one, you can rely on the fact that it *will not change* on you. It is immutable.

9:41 npoektop: why not create a new map and just start using that one instead of the old one?

9:42 hoeck: kzar: class-not-found exception?

9:43 kzar: try (->> (System/getProperty "java.class.path") (.split #":") seq (map println) dorun) and look wether your .swank-clojure/compojure.jar is actually on the classpath

9:44 npoektop: chouser, how to bind (assoc my-map ...) to my-map?

9:44 AWizzArd: if my-map is state then it could be a ref

9:45 npoektop: AWizzArd, it's a variable

9:46 hoeck: kzar: maybe you have to restart emacs too (after putting jars into .swank-clojure or .clojure)

9:46 AWizzArd: npoektop: when it needs to get accessed from several parts of your program and is something that could in principle get stored in a db, then you can say (def my-map (ref {})) and assoc into it within dosync

9:47 kzar: hoeck: Yea when I do it says it couldn't find anything like clojure.clj etc. Doing that command does list compojure.jar as one of the items. I have restarted emacs

9:48 npoektop: AWizzArd, yeah. I've just read that section. But i need smth simpler. I know it's a lame question, but i can't find how to do (_bind_ my-map (assoc my-map ...))

9:48 chouser: npoektop: it depends on your context. AWizzArd is correct, but often the "rebinding" can be done locally and so no reference type is needed.

9:49 ,(loop [m {}, i 0] (if (> i 5) m (recur (assoc m i (str i)) (inc i))))

9:49 clojurebot: {5 "5", 4 "4", 3 "3", 2 "2", 1 "1", 0 "0"}

9:49 hoeck: kzar: can you paste your error to lisppaste or gist.github.com?

9:49 AWizzArd: npoektop: for transient data you should follow chouser advice and rebind it locally, or use reduce or recursion.

9:50 chouser: npoektop: there, each time through the loop, m and i are bound to a new value, even though the values themselves (a map and an integer respectively) never change.

9:51 hoeck: kzar: compojure has also some more dependencies in the deps/ directory, maybe you have to add them to .swank-clojure too

9:54 kzar: hoeck: hmm OK, here's the paste http://paste.lisp.org/display/97768

9:54 sexpbot: Execution Timed Out!

9:57 kzar: hoeck: brb, trying again now that the deps are there

9:59 jfields: is there a good example of using (-> ) anywhere?

10:01 kzar: hoeck: hey that worked, copied everything from compojure/lib into ./swank-clojure, restarted and it works :)

10:01 hoeck: kzar: great :)

10:01 Raynes: $(-> 3 (+ 4) (+ 1) (quot 3))

10:01 sexpbot: 2

10:02 Raynes: jfields: Are you having trouble understanding it?

10:03 jfields: would prefer one example with each function, to help with understanding, I think I get it tho.

10:04 Raynes: My previous example would end up as (quot (+ (+ 3 4) 1) 3)

10:04 kzar: ah crap it didn't work I typed (use :compojure) by mistake which returned nil

10:05 * Raynes wonders why sexpbot timed out a moment ago.

10:06 Raynes: It's ignoring that link kzar posted, because it has "paste" in it, so it's odd that it just randomly timed out.

10:06 kzar: Think you could drop in #clojure-causal for a moment and mention that link again?

10:07 hoeck: kzar: mhh, maybe your compojure.jar is corrupt? can you open it in midnight-commander and examine its contents?

10:11 kzar: (or use jar -t compojure.jar on the commandline)

10:12 kzar: hoeck: Should that command take a long time?

10:13 hoeck: kzar: maybe, the jar command is slow, thats why I'm always using mc :)

10:14 kzar: hoeck: Heh ok, all this is new to me anyway. brb going to make some tea. Thanks for the help

10:14 so far

10:14 hoeck: kzar: unzip -l compojure.jar will also work, and its faster :)

10:37 kzar: still going heh

10:38 wlangstroth: jfields: http://java.ociweb.com/mark/clojure/article.html

10:38 do a find for "(->"

10:38 that's the clearest example I've found

10:38 hoeck: kzar: the jar -t ?

10:39 sexpbot: Execution Timed Out!

10:39 Raynes: Aha!

10:39 Oh wait.

10:39 Never mind. :|

10:39 wlangstroth: ie (-> x f3 f2 f1) is the same as (f1 (f2 (f3 x)))

10:40 kzar: hoeck: Yea, just tried the other command on a different machine and that was instat. Pasted an annotation to my paste with the output

10:40 AWizzArd: ((comp f1 f2 f3) x) is also an alternative

10:40 kzar: isntant*

10:40 ahh can't type

10:40 Raynes: That last one was because that article is huge and it didn't find a title in time.

10:41 * Raynes considers making timeouts quiet.

10:41 Raynes: At least for URL grabbing.

10:41 * Raynes does that.

10:41 hoeck: kzar: oh, there is something missing in your compojure.jar!

10:42 wlangstroth: AWizzArd: comp doesn't sit well with me, but maybe I have to warm up to it

10:42 kzar: hoeck: ah bugger, at least that 'splains it

10:42 Raynes: You don't like function composition?

10:42 You'd hate Haskell.

10:43 wlangstroth: Raynes: no, it's the format - I prefer -> to comp

10:43 AWizzArd: wlangstroth: I also like -> because it lets us list the jobs in the order we think about them, while comp reverses this but reads like (f1 (f2 (f3 x))) === (comp f1 f2 f3)

10:43 hoeck: kzar: it should be about 0.5M in size, containing around 400 files

10:43 Raynes: Oh. I agree.

10:43 hoeck: kzar: maybe download it again or run ant/lein whatever to rebuild it

10:43 Chousuke: comp creates a new function though

10:43 kzar: hoeck: Yea I'll get a proper version, I know how to test it's good now as well

10:44 hoeck: Thanks for helping me

10:44 Chousuke: so ((comp x1 x2 x3) foo) is more wasteful than (-> foo x1 x2 x3)

10:44 hoeck: kzar: youre welcome :)

10:44 wlangstroth: Chousuke: haha - exactly

10:45 AWizzArd: Is something like reflection planned for defrecords? (defrecord Foo [a b c]), (reflect (create-Foo 1 2 3)) ==> {:class Foo, :create-fn #<ns$_create-Foo___36@e3ed>, :fields [a b c], :options {}}

10:46 Chousuke: you can always use the java reflection APIs :P

10:46 * AWizzArd cheers

10:47 Chousuke: but hm.

10:47 I accidentally pressed Cmd-Q in emacs, and it then asked whether I want to quit, as there are processes running

10:48 I answered no, the dialog went away, and... emacs quit.

10:49 that's a wierd bug to have :P

10:49 weird*

10:50 rhickey: question #2 for the day - record equality can have either straight map semantics or include same-type check - preferences?

10:50 hoeck: Chousuke: mhh, doesn't he ask "there are active processes, still want to quit" yes/no?

10:50 AWizzArd: include same-type check please

10:50 Chousuke: hoeck: yes, it did. and I answered no, and it still quit :P

10:51 AWizzArd: rhickey: please allow me to ask if for Q#1 there is a descision yet.

10:51 Licenser_: lein search has now update (which updates used libraries :)

10:52 rhickey: AWizzArd: no

10:52 Chousuke: rhickey: would there be a way to compare records with map-semantics too then?

10:53 rhickey: Chousuke: dunno, but there is only one =

10:53 AWizzArd: I just see that there will be more usecases for included types.

10:55 cemerick: rhickey: map semantics please.

10:56 rhickey: cemerick: current deftype uses type tag

10:57 cemerick: yeah, I noticed :-)

10:59 Mixing the type tag into equality seems decidedly contrary to the general approach; records are just bags of slots (expandable, even), protocols cut across all hierarchies as necessary, etc.

11:00 rhickey: cemerick: I don't get your point re: protocols

11:01 AWizzArd: the name defrecord already implies for me that type information is an important one

11:01 first of all it is a specific kind of data collection, and only secondary it is a map

11:03 (into {} (create-Foo 1 2 3)) ==> {:a 1, :b 2, :c 3}

11:03 Chousuke: I'm more inclined to think that a record is just a map that has been given a name

11:03 AWizzArd: if that were possible then it would be easy to compare with map semantics

11:03 sattvik: rhickey: Is there a significant performance penalty for one approach over the other? To a certain extent, I think that type checking vs. general seems somewhat analogous to equals vs. equalsIgnoreCase.

11:04 AWizzArd: Chousuke: (def x {:a 1, :b 2}) is in my opinion a named map, while (defrecord Foo ..) is more general, it categorizes maps of a specific kind.

11:04 rhickey: sattvik: perf shouldn't matter for this decision

11:04 AWizzArd: Leaving out the the type in comparisons would miss the point.

11:04 cemerick: rhickey: my point (hardly made) was that IMO, records are their slots, for which the type tag is merely a shorthand, and it seems that protocols take the same stance.

11:05 rhickey: cemerick: protocols don't seem subject to meaningful equality

11:05 cemerick: hrm, now I'm arguing with myself in my head

11:06 sattvik: cemerick: So would two types with equivalent content be equivalent?

11:06 cemerick: sattvik: that's what I've been suggesting, yes.

11:06 wait, I'm going to go get a Snapple, and then be back with an astonishingly convincing argument.

11:07 rhickey: or recant :)

11:07 * cemerick apologizes to those who don't get the joke

11:08 AWizzArd: In principle we would have to see how people are using it. If the place is scattered with (and (instance? Foo obj1) (instance Foo obj2) (= obj1 obj2)) something is wrong.

11:08 But (= (into {} obj1) random-map) is not bad for the case without the type.

11:08 sattvik: Hmm.. should (= (create-Type1 1 false) (create-Type2 1 false))? From a Java perspective, this generally is not the case, but this is not Java...

11:09 wlangstroth: I'm going to avoid toolshedding entirely, but is there anywhere the defrecord issue is laid out in detail?

11:12 AWizzArd: Not implicating the type means in principle that a programmer is forced to manually check for the types explicitly in every single comparison, if he/she wants clean and self-documenting code.

11:13 sattvik: More specifically, should (= (create-RadialPoint 0.4 1.0) (create-CartesianPont 0.4 1.0))?

11:13 AWizzArd: type errors may get detected much later without implicit type checking

11:14 cemerick: sattvik: presumably, the names of the slots are different for those objects.

11:15 rhickey: cemerick: that's a weak standard

11:15 cemerick: yeah, I know

11:16 AWizzArd: cemerick: now that defrecords will possibly get a stable name we can get even more useful serialization (long-term that is, and over the network)

11:16 seths: rhickey: OT: how likely are breaking changes to deftype before Apr 22? I'm presenting labrepl then and want to be ready to update the code

11:16 cemerick: Once concern I have w.r.t. including the tag is it potentially makes interop between two established, related libraries more difficult.

11:16 rhickey: AWizzArd: they always got a stable name when AOTed

11:16 cemerick: how so?

11:17 sattvik: cemerick: That's true. Or, at least, one should hope so. I am not sure I have a preference. The more general approach does seem more in line with how clojure handles value in general. After all (= [1.0] '(1)).

11:17 AWizzArd: rhickey: I mean more the "even dynamically" part of your update today :)

11:18 rhickey: AWizzArd: that won't hold since while the names might be the same, the classes won't necessarily, and thus the serialization won't be dynamically viable

11:19 AWizzArd: rhickey: ok, i see. And what about this example case: I don't aot my code and serialize instances of (defrecord Foo [x]), then restart the jvm and reload the code and try to deserialize. Would that work, if the fields of the class didn't change?

11:20 cemerick: rhickey: well, consider ring and compojure -- for some time, the latter produced "ring-compliant" objects (requests, responses, etc). In such a situation, where one wants to produce records that are functionally equivalent to another lib's records, one would have to use that other lib's defrecord types. That seems like an unnecessary barrier.

11:20 rhickey: cemerick: your extending this equality limitation to a greater extent, other than equality, they will be substantially interoperable

11:21 you're

11:21 cemerick: I suppose it's largely irrelevant in a world where everyone's using protocols.

11:21 AWizzArd: cemerick: even when you use Protocols?

11:22 what if in this scenario my defrecord is incompatible? Then this would go unnoticed, because for a short moment some other ring defrecord may contain the same data/fields, but generally is incompatible.

11:22 cemerick: also if (= your-map (into {} some-ring-record)) worked or something similar it would still be fine.

11:23 cemerick: sure, but I'd like to be sure we don't need/want that wart :-)

11:23 AWizzArd: When I vote for "please include the type check" I don't want to *forbid* map-like comparisons.

11:23 Just getting the default right.

11:23 cemerick: OK, let's get into stupid question territory: what are the types *for*? (a) protocol dispatch, (b) construction of an object matching the type's declaration, (c) ....?

11:24 AWizzArd: program correctness

11:24 cemerick: AWizzArd: meaning what?

11:24 rhickey: (c) interface implementation, (d) primitive fields, (e) fast accessors

11:24 AWizzArd: or filtering specific objects out of a vector of records

11:24 cemerick: rhickey: yeah, I was (perhaps foolishly) trying to stay away from impl details

11:25 AWizzArd: cemerick: I have no concrete case for that, I just think that objects may slip through comparisons as equal and produce some problems later on

11:26 sattvik: cemerick: Perhaps interop with host libraries? If I understand it correctly, you could deftype an EJB.

11:27 AWizzArd: Btw, will the newdeftype be able to do (deftype clojure.lang.PersistentVector ...)?

11:27 cemerick: sattvik: sure -- and in that case, you're sort of opting into the host type hierarchy.

11:27 AWizzArd: OK; say you have type A with slots :start and :end, and type B with slots :start and :end -- if your operations are protocols, where does an "erroneous" equality check lead you astray?

11:27 * cemerick honestly playing devil's advocate

11:28 rhickey: cemerick: I'd flip it around, doesn't the fact that protocols won't match a same-shaped thing already create a difference?

11:29 i.e. equality alone doesn't break interop

11:29 cemerick: rhickey: yeah, that was what I was getting at with the ring/compojure interop thing not really being germane given protocols.

11:30 rhickey: cemerick: there is a huge amount of data manipulating stuff around maps that will still work, but I'm not sure entire-map-equality is that important an operation

11:31 when manipulating things like records

11:31 cemerick: yeah, neither am I

11:31 rhickey: and when it is, you don't ever want apples = oranges

11:32 maybe a-map-literal = an-orange

11:32 but I'm hoping for a convenient literal form for orange

11:32 #Orange{:a 1 :b 2} or something

11:33 cemerick: I'm just trying to ferret out what it means for types to be involved in equality in general, i.e. why (= #Bar{:a 5 :b 6} #Foo{:a 5 :b 5}) would be bad

11:33 rhickey: cemerick: when Foos and Bars are used as keys in a map?

11:33 AWizzArd: Although there exists one case where it would be comfortable to have a map-like comparison: we don't need to create artificial Foos just for comparisons, or otherwise hack some verbose code. (= some-foo {:a 1, :b2}) vs (= some-foo (create-Foo 1 2))

11:34 rhickey: cemerick: when Foos and Bars are placed in a set

11:34 oops, some disappear

11:34 cemerick: rhickey: well, whether that's good or bad depends on one's preference w.r.t. equality semantics

11:35 AWizzArd: I already stumbled upon this with sorted-set-bys or sorted maps, don't remember, but I think it were sets. To get objects out of a set with subseq I had to artificially create deftype instances so that the comparator would work.

11:35 rhickey: cemerick: so, no oranges for me when I send you to buy groceries? :)

11:35 * cemerick has never liked citrus *that* much ;-)

11:35 AWizzArd: I think rhickey got a point here, because that position is more safe. One may want another semantics, but then one should really write ones own comparator.

11:36 rhickey: cemerick: a common complaint when people were using metadata for types was that it *didn't* participate in equality

11:37 cemerick: the other side will be coming for you shortly :-P

11:37 rhickey: cemerick: likely

11:37 cemerick: Having to consider types at all is an odd-feeling reversion after a long time with just maps and multimethods.

11:37 rhickey: cemerick: but what were you using to distinguish your multimethods?

11:39 AWizzArd: I always added a :type slot *sigh*

11:39 cemerick: sometimes class or type, oftentimes existence of slots necessary to support the methods being dispatched to.

11:39 Some would say the latter is "manifest typing". 0.0

11:39 hrm, wrong emoticon

11:41 so, given protocol dispatch, I'm now flipping to include type in equality.

11:41 But there has to be a better solution for untyped equality than (= some-map (into {} foo-record))

11:41 * rhickey predicted recant at 11:06

11:41 AWizzArd: (:

11:41 cemerick: rhickey: the journey is the reward :-)

11:42 rhickey: cemerick: I agree, and it ends up type-including equality can be built on type-ignoring but not vice-versa

11:42 cemerick: plus, I got to scare AWizzArd a little ;-)

11:43 rhickey: are we talking about anything fancier than a map-level = plus an instanceof?

11:44 Licenser_: Is the (theoretical Foo) here a java object or something else? Idnd

11:44 rhickey: cemerick: I appreciate the push-back. Now with defrecord distinct from deftype it would be possible to do something slightly less efficient with defrecord, if the flexibility was there

11:44 cemerick: nope, just that

11:44 Licenser_: 't joined early enough sadly

11:44 rhickey: cemerick: actually identical? classes

11:44 not instanceof

11:44 cemerick: oh, right

11:45 rhickey: one nice thing about types as metadata was that it was easy to spoof a type on the fly

11:47 otoh, there's no way to get the perf that deftype + protocols can deliver

11:47 moshisushi: hello tehre

11:47 noob question: http://pastie.org/919515

11:48 cemerick: moshisushi: you need to use clojure.contrib.duck-streams before you can invoke reader directly

11:48 or, better yet, (require '[clojure.contrib.duck-streams :as io]) and then use io/reader

11:48 Licenser_: moshisushi: you - okay cem was faster

11:48 moshisushi: :>

11:50 cemerick: Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj on classpath

11:50 bsteuber: rhickey: I'm currently working on docstring-support for def - will there be a chance you accept the patch once I sent you the contributor agreement?

11:50 moshisushi: hmm

11:50 cemerick: moshisushi: what does your classpath look like?

11:50 moshisushi: just clojure.jar right now

11:51 Licenser_: ah you need clojure-contrib.jar too

11:51 cemerick: make sure it's the same corresponding version, though.

11:51 moshisushi: Licenser_: makes sense! sorry for bothering y'all with these lamey questions

11:52 Licenser_: moshisushi: you are not bothering at all

11:53 moshisushi: oh by they way... anyone knows of a "quotable" paper/article on clojure STM? i'm writing a bachelors essay on STM (in Haskell specifically), and would love to add a short comparison to the clojure dito

11:59 cemerick: rhickey: you replied "not yet" to Stu's question re: protocol dispatch precedence on the list last month. Should I read that as "coming soon" or "should be possible, but it's not on the table", or something in between? :-)

12:00 rhickey: cemerick: I really don't want to repeat "prefers"

12:01 cemerick: rhickey: what was wrong with prefers?

12:03 rhickey: cemerick: less a problem with prefers than with the situation it addresses (MI of interfaces and the ability to hook protocols up to interfaces). I don't have another solution at present

12:08 * rhickey waits for problem to go away

12:08 cemerick: good luck on that one :-)

12:08 Licenser_: rhickey: I'd watch out this practice is patented by Siemens

12:11 cemerick: Could just dispatch based on lexicographic order when there's ambiguity. Would make interface names a lot more amusing.

12:12 Licenser_: a0001Cow a0002Sheep a0003Dog

12:12 weeh for class names :P

12:12 rhickey: cemerick: but the problem is always pre-existing interfaces

12:12 cemerick: rhickey: sure

12:12 that was a joke, there, son! :-P

12:12 Licenser_: can't you give the multi method a kind of 'compare' function?

12:13 cemerick: Licenser_: you can declare dispatch value priority.

12:14 Licenser_: so where is the problem?

12:20 rhickey: Licenser_: no similar capability for protocols yet

12:22 Licenser_: oh okay

13:39 borkdude: Guys, whenever I start swank-clojure-project in Emacs, it keeps polling forever

13:39 what could be wrong?

13:41 bsteuber: Borkdude: check your *inferior-lisp* buffer

13:44 Borkdude: bsteuber: it starts a server

13:44 (do (.. java.net.InetAddress getLocalHost getHostAddress) nil)(swank.swank/start-server "/tmp/slime.2347" :encoding "iso-latin-1-unix")

13:44

13:45 And then this happens... Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main

13:47 bsteuber: does swank-clojure-project use clojure+clojure.contrib from the project's lib directory?

13:47 polypus: Borkdude: yes it does

13:47 Borkdude: I have the lib directory at war/WEB-INF/lib

13:47 polypus: i don't think it'll find it there

13:47 cemerick: rhickey: Not sure if you're watching this, but this issue is a combination of mundane and really important: https://www.assembla.com/spaces/clojure/tickets/281-make-more-datastructures-serializable

13:48 sexpbot: #281 - Make more datastructures serializable (Test) | Clojure | Assembla

13:48 Borkdude: I am trying to run this project here http://github.com/sethtrain/beget

13:49 ah.. so swank-clojure-project doesn't really 'read' project.clj, it just supposes you use the same structure always?

13:49 that would explain

13:49 polypus: yep. that got me once too

13:54 s450r1: Borkdude: since you have a project.clj, I'm guessing you're using lein? If so, you can run "lein swank" and then connect from emacs with M-x slime-connect. Then you can use the jars in war/WEB-INF/lib, I think.

13:55 bsteuber: Borkdude: so maybe you should go with lein swank then

13:55 s450r1: oh, didn't see your post

13:55 Borkdude: s450r1, ah that sounds helpful

13:56 I now made a symbolic link from lib to the war dir which also works

13:56 but lein swank sounds cleaner

13:57 s450r1: borkdude@Ubuntu-VM:~/temp/beget$ lein swank

13:57 swank is not a task. Use "help" to list all tasks.

13:57

13:58 ah I see I need a plugin, sorry

13:58 bsteuber: yeah, they changed this

13:59 technomancy: no, it's always been a separate plugin

14:00 s450r1: Borkdude: oops, sorry, should have included that information

14:00 http://wiki.github.com/technomancy/leiningen/emacs-integration

14:00 bsteuber: technomancy: oh - then I guess I used the plugin without realizing :)

14:01 Borkdude: s450r1: yup, it works, thanks!

14:06 s450r1: np, technomancy did all the work :-)

14:07 technomancy: thanks for all your projects, I'm using a good number of them... oh wow, relax.el, I think I can use that right now. Sweet!

14:07 technomancy: s450r1: that makes one of us

14:08 I haven't used it since I wrote it =)

14:09 wlangstroth: technomancy: lein is gold, though

14:10 technomancy: I'm not trying to embarrass you or anything, but if I had to start with maven instead of being eased into the process with leiningen, that would have been painful

14:11 so thanks from me, too

14:15 technomancy: great =)

14:33 * LauJensen pats technomancy on the shoulder - keep up the good work ol' pal :)

15:20 Borkdude: How do I specify the namespaces to compile in a project.clj?

15:20 :namespaces [beget beget.templates] ??

15:22 I changed the beget/templates.clj file lein says all :namespaces already compiled

15:23 jweiss: is there a fn, maybe in contrib that will automatically (use 'blah.blorg :reload-all) when i save blah/blorg.clj?

15:28 LauJensen: jweiss: You aren't that PHP blogger by any chance, are you?

15:28 jweiss: LauJensen: PHP? good lord, no

15:28 LauJensen: Ok, then I'll be happy to help

15:28 jweiss: hehe

15:29 LauJensen: Clojure doesn't know when you're saving files, you if you want that kind of functionality, you need to work it into Emacs

15:29 (just kidding, I have no hate for PHP bloggers)

15:29 jweiss: LauJensen: yeah i figured it'd either have to run as a thread or agent from the repl

15:29 but your emacs suggestion sounds interesting as well

15:40 programble: wow

15:40 * programble <3 #clojure

15:40 programble: you guys arent pricks

15:41 heejp: hey

15:41 can anybody help me with something, please?

15:41 programble: fuckin #python pricks

15:41 heejp: just ask :)

15:41 heejp: I'm having trouble with multimethod dispatch functions

15:42 I'm working on an object system called Fenrir

15:42 and here's my instance making function:

15:42 (defmulti new-obj #(:_fenrir_class-name %))

15:42 (defmethod new-obj ::fObject [fclass & kvals]

15:42 (with-meta (apply struct-map (conj kvals (:_fenrir_struct fclass)))

15:42 {:_fenrir_class (:_fenrir_class-name fclass)}))

15:42 kotarak: heejp: please paste somewhere and post the link here

15:42 LauJensen: ~paste

15:42 clojurebot: lisppaste8, url

15:42 kotarak: eg. paste.lisp.org

15:43 heejp: sorry

15:43 LauJensen: programble: One of the tricks of keeping a calm and friendly community, is to avoid from foul language and dissing other groups - So appologize and move on :)

15:43 heejp: I'll take that into account next time

15:43 anyway

15:43 with that code snippet I pasted

15:43 when I do something like this:

15:44 (new-obj fGameObject :location 1 :sprite 2)

15:44 I get this error:

15:44 java.lang.IllegalArgumentException: Wrong number of args passed to: core$fn (repl-1:17)

15:44 kotarak: heejp: you dispatch function must take the same number of arguments. Try: #(:_fenrir_class-nam (first %&))

15:45 heejp: um...

15:45 I see

15:45 let me try it

15:45 hiredman: (comp :_fenrir_class-nam first list)

15:46 heejp: hey

15:46 it worked!

15:46 hehehehe

15:46 thanks, guys

15:58 dakrone: ,(.replaceAll "foo\bar" "\\" "SLASH")

15:58 clojurebot: java.util.regex.PatternSyntaxException: Unexpected internal error near index 1 \ ^

15:58 dakrone: ,(.replaceAll "foo\\bar" "\\" "SLASH")

15:58 clojurebot: java.util.regex.PatternSyntaxException: Unexpected internal error near index 1 \ ^

15:58 dakrone: ,(.replaceAll "foo\bar" "\\\" "SLASH")

15:58 clojurebot: EOF while reading string

15:58 dakrone: ,(.replaceAll "foo\bar" "\\\\" "SLASH")

15:58 clojurebot: "foo\bar"

15:58 dakrone: can someone tell me how to get the backslash replaced?

15:59 kotarak: ,(.replaceAll "foo\\bar" "\\\\" "SLASH")

15:59 clojurebot: "fooSLASHbar"

15:59 kotarak: I think "\b" is bell, no?

15:59 programble: it is

15:59 no wait

15:59 isnt that \a?

16:00 kotarak: backspace, maybe?

16:00 programble: yes

16:00 dakrone: okay, why the 4 slashes for 1 regular slash?

16:00 kotarak: 2 for the string, 2 for the regex

16:01 regex requires \\, but \\ in a String is only one \.

16:01 opqdonut: the string "\\\\" is really the string "\\" which corresponds to the regex "\"

16:01 dakrone: ahh, so escaping for the reader, then escaping again for the regex

16:01 hiredman: ,(->> #"" class .getMethods (map #(.getName %)))

16:01 clojurebot: ("toString" "matches" "split" "split" "compile" "compile" "matcher" "quote" "pattern" "flags" "wait" "wait" "wait" "hashCode" "getClass" "equals" "notify" "notifyAll")

16:02 hiredman: split but no replace

16:02 opqdonut: dakrone: yeah, basically

16:02 kotarak: ,(.toString #"\\")

16:02 clojurebot: "\\\\"

16:03 kotarak: ,(str #"\\")

16:03 clojurebot: "\\\\"

16:03 Borkdude: And then suddenly 'lein swank' stopped working, no idea what happened

16:03 kotarak: ,(.replaceAll "foo\\bar" (str #"\\") "SLASH")

16:03 clojurebot: "fooSLASHbar"

16:03 dakrone: how does http://gist.github.com/366261 look for stripping out Clojure reader chars

16:03 am I missing any?

16:04 Borkdude: still have this in my project.clj: :dev-dependencies [[swank-clojure "1.1.0"]

16:04 [leiningen/lein-swank "1.1.0"]]

16:04 then it should just work, right?

16:04 LauJensen: dakrone: ^ ?

16:05 hiredman: dakrone: http://github.com/hiredman/clojure/blob/readerII/src/clj/clojure/reader.clj#L516

16:05 kotarak: ^ is deprecated

16:05 hiredman: oh

16:05 LauJensen: I vote for undeprecating it!

16:05 hiredman: reader macros

16:05 LauJensen: Oh wait, we're not voting :)

16:05 hiredman: it's going to be used for type hinting

16:06 kotarak: "clojure is not designed by public voting" rhickey (or something like that) (and that's good, IMHO)

16:06 dakrone: LauJensen: thanks, I'll add that one

16:06 hiredman: cool, thanks

16:07 LauJensen: kotarak: Of course its good

16:08 StartsWithK: there should be a secret voting then :)

16:08 LauJensen: StartsWithK: oh there is...

16:08 I'm pretty sure :)

16:09 hiredman: clojurebot: secrets?

16:09 clojurebot: I don't understand.

16:09 StartsWithK: hmm.. is there a secret handshake too.. we may never know

16:09 hiredman: I think polls have been on the todo list for clojurebot forever now

16:11 kotarak: StartsWithK: #^'~@ (<- secret reader macro)

16:12 StartsWithK: kotarak, hehehe

16:12 LauJensen: The secret is, that when you see the Clojure Logo in a mirror, it reads "PERL" in swirly 3d letters

16:13 StartsWithK: repl is a hidden clue :)

16:13 kotarak: I use Clojure as my secret weapon at work. Maybe we'll be able to hide clojure in perl programs to perfect this technique.

16:20 raek: what is recommended for signaling exceptions? deftype'd java exceptions? c.c.error-kit? c.c.condition?

16:23 StartsWithK: raek, gen-class is your only option if you want new exception name (or java)

16:23 raek: I want the ability do distinguish different kinds of errors

16:24 hiredman: condition has a niggling little bug that I don't think is fixed upstream yet

16:24 raek: ...but not neccerarily by having a java class for each one

16:24 hiredman: the various java.lang exceptions aren't good enough?

16:24 Borkdude: Any idea why my 'lein swank' is not working anymore?

16:24 hiredman: clojurebot: exceptions!

16:24 clojurebot: http://paste.lisp.org/display/74305

16:25 Borkdude: It worked an hour or so ago...

16:25 hiredman: clojurebot: botsnack

16:25 clojurebot: thanks; that was delicious. (nom nom nom)

16:25 bsteuber: Borkdude: what's the exact problem?

16:25 Borkdude: it says 'swank is not a task'

16:26 hiredman: have you run lien deps?

16:26 Borkdude: hiredman, yes, but I will do it now to be sure

16:26 hiredman: the swank plugin needs to be a dev dependency

16:26 and deps will fetch it

16:28 Borkdude: ah I now get it

16:28 also with lein swank it doesn't support the lib directory to be something other than <proj-dir>/lib

16:29 even if specified otherwise in project.clj

16:29 even if > although I mean

16:39 slyphon: anyone else have slime sort of mysteriously change back to the 'user' namespace occasionally?

16:41 tomoj: when I tell it to switch into a namespace that doesn't exist, it goes back to 'user'

16:41 that's the only time I've noticed it

16:41 slyphon: hmm

16:41 oh, maybe it's when i open a namespace i haven't previously required

16:41 or compiled

16:41 tomoj: yeah, that would do it

16:42 slyphon: ok, as long as i'm not just losing it :)

16:48 ztellman: ,(assoc {} :octaves 3)

16:48 clojurebot: {:octaves 3}

16:48 ztellman: hmm, in 1.2.0 that throws an exception for that particular keyword

16:48 anyone know why?

16:51 chouser: ztellman: seems to work fine here

16:52 dakrone: yea, same here

16:52 ztellman: hmm, when I open a fresh repl it works fine for me too

16:53 weird, dunno how I got into this state

16:53 tomoj: what's the exception??

16:53 ztellman: (class: example/opengl/marble$eval__70767, method: <clinit> signature: ()V) Incompatible argument to function

17:19 Licenser: is there a function to test if something is a map?

17:19 aka hashmap

17:20 remleduff: associative? maybe

17:21 tomoj: well, there's map?

17:22 Raynes: $(map {})

17:22 sexpbot: Wrong number of args passed to: core$map

17:22 Raynes: $(map? {})

17:22 sexpbot: DENIED!

17:22 Raynes: Orly

17:22 Must not have map? whitelisted.

17:22 remleduff: $(associative? {})

17:22 sexpbot: false

17:22 remleduff: Color me surprised

17:22 $(associative? [])

17:22 sexpbot: true

17:23 Raynes: Whoda thunk it?

17:23 remleduff: $(doc associative?)

17:23 sexpbot: ------------------------- clojure.core/associative? ([coll]) Returns true if coll implements Associative

17:23 tomoj: uhh

17:23 here, (associative? {}) is true

17:23 Raynes: ,(associative? {})

17:23 clojurebot: true

17:24 Raynes: Licenser: ^ That's kind of weird.

17:24 * Raynes checks to see if this is some sort of weird clj-sandbox thing.

17:24 Licenser: no that my friend is a bug

17:24 Raynes: Oh.

17:24 I thought so.

17:30 Licenser: thanks for the help and night people

18:00 maacl: Why would I get a null pointer exception if I try to do M-. (using emacs/SLIME) on a the name of a var in the same file as it is defined, while it works perfectly well if doing the same from within another file?

18:08 dnolen: maacl: that will only work if you ran compile file (C-c C-k) on that file, if you eval'ed a secpr with C-x C-e, M-. will not work

18:09 maacl: dnolen: ah, thanks

20:27 rhickey: it's alive! - first cut of defrecord is up

20:33 arohner: http://arohner.blogspot.com/2010/04/writing-jquery-code-with-scriptjure.html thoughts?

20:33 sexpbot: /dev/rohner: Writing JQuery code with Scriptjure

22:27 vIkSiT: hi all

22:27 can anyone point me to some documentation on settings up slime / swank for a specific project started using lein?

22:30 slyphon: http://technomancy.us/126

22:30 sexpbot: in which are found tricks of the trade concerning clojure authorship - Technomancy

22:35 vIkSiT: slyphon, ah my problem is that once I do M-x swank-clojure-mode .. and point it to the proejct dir..

22:36 I'm still stuck with a "Polling /var/folders.." message and slime never starts up.

22:36 slyphon: does "lein repl" work in your project dir?

22:36 clojurebot: http://www.thelastcitadel.com/dirt-simple-clojure

22:37 vIkSiT: hmm

22:37 yes it does - but looks like it takes 1.1.0 rather than 1.2.0-master that I have otherwise

22:38 slyphon: 1.2.0 hasn't been released officially yet, afaik

22:39 Raynes: 1.2.0 master works with it.

22:39 vIkSiT: slyphon, ah yes, I mean that 1.2.0 is the JAR I'm using in my CP

22:39 so I guess there are 2 issues : 1) lein repl picks up a 1.1.0 jar; and 2) swank doesn't connect to anything at all.

22:40 so 1) can i specify a version of clojure for lein to use, and 2) is there a way to see the output of the swank-polling process to see where it hangs?

22:40 arohner: vIkSiT: the released version of lein starts the clojure version it's built with

22:40 sorry, the stable version of lein

22:40 vIkSiT: arohner, ohh I see.

22:41 arohner: that's fixed on lein HEAD

22:41 vIkSiT: that sucks

22:41 do you recommend using the version of lein that runs 1.2.0?

22:41 arohner: I haven't tried it, but I think other people are using it successfully

22:42 vIkSiT: ah ok.

22:42 and any ideas about question 2) ?

22:43 slyphon: *slime-events* buffer?

22:43 i usually do lein swank

22:43 arohner: also check *inferior-lisp*

22:43 slyphon: and then connect using M-x slime-connect

22:43 that way if there's a narsty stack trace i see it

22:43 * arohner also uses slime-connect

22:43 slyphon: (it also lets you set properties on the command line)

22:44 (more easily than the other way)

22:45 vIkSiT: wait, you do lein swank from the command line?

22:45 is that a valid option?

22:45 slyphon: yes

22:45 vIkSiT: weird. It doesn't seem so in my case

22:45 slyphon: are you using a recent lein

22:45 wait, hang on

22:46 vIkSiT: "swank is not a task. Use "help" to list all tasks."

22:46 slyphon: lein version?

22:47 liebke: make sure you have [leiningen/lein-swank "1.1.0"] in your project file in :dev-dependencies

22:47 slyphon: ah, that too

22:47 it's a plugin

22:51 vIkSiT: one sec, checkingversion

22:51 its 1.1.0

22:51 I've added :dev-dependencies [[leiningen/lein-swank "1.1.0"]] to my project.clj now

22:53 and now doing a lein deps.

23:07 arohner: so if I have a deftype/defrecord, and I get its constructor, java claims the constructor takes n+2 arguments, where 2 is the number of fields I have

23:07 lisppaste8: url?

23:08 hiredman: arohner: I imagine it also takes a map of metadata and maybe other stuff

23:08 arohner: hiredman: oh right, there are two

23:24 hiredman: btw, props again on naming c.c.java-utils/wallhack

23:24 I have a legitimate use for it now, and I smile each time I see the name

23:34 timcharper: Is there a way to map a collection of values across a function that has a side effect and still get the return value?

23:34 Actually using the return value (somewhere down the line) is optional.

23:34 (I'm mapping over a collection of hash maps and inserting records in a database, returning the results from those inserts)

23:35 However, doseq, while successfully causing the side effects to occur, returns nil

23:36 arohner: timcharper: you can (doall (for [] ...))

23:36 or (doall (map...))

23:37 timcharper: Excellent! That's exactly what I'm looking for :-) thank you!

Logging service provided by n01se.net