#clojure log - Jun 14 2010

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

0:00 LuminousMonkey: I can just use a cycle sequence so for a given column I can get the correct align info, but at the moment I'm using a doseq and a for, and it can't be the best way to do it, and I'm just new to Clojure.

0:00 (doseq [row (for [row (rest table-data)] (interleave (first table-data) row))]

0:00 (process-table-row table row))

0:02 tomoj: ,(map vector (cycle [1 2]) [:foo :bar :baz :bing])

0:02 clojurebot: ([1 :foo] [2 :bar] [1 :baz] [2 :bing])

0:02 LuminousMonkey: (defn process-table-row

0:02 tomoj: how does that help you?

0:02 LuminousMonkey: "Given a row, steps through and adds the cells to the table, a map is

0:02 expected to be in-front of the cell data for aligning options, etc."

0:02 [table row]

0:02 (doseq [cell row] (if (map? cell) (process-cell-options cell table) (.addCell table cell))))

0:02 clojurebot: macro help is http://clojure-log.n01se.net/macro.html

0:04 LuminousMonkey: I was hoping to get them in seperate args to the function, that was I can get rid of the (if map?)

0:04 tomoj: LuminousMonkey: paste on gist or paste.lisp.org or pastie or pastebin or whatever you like

0:04 LuminousMonkey: It works as I have it now, it just seems to damn ugly. :)

0:07 http://pastie.org/1003361

0:11 Example of data being passed in: http://pastie.org/1003377

0:45 vIkSiT: hmm, so If I'm in (ns myproject.core) in core.clj, and I have a file called db.clj, which has a (ns myproject.db).

0:45 whats the best way to use db within core?

0:45 should I be using - :use or :require?

0:48 TeXnomancy: vIkSiT: if you are just using a few vars from the db namespace I would stick with (:use [myproject.db :only [my-fn my-other-fn]])

0:48 but if you have a lot, then (:require [myproject.db :as db])

0:48 vIkSiT: TeXnomancy, ah yes, probably the latter then. hmm

0:48 Scriptor: is there a way to turn off the indentation specific to vimclojure, so that I can go back to the settings in my .vimrc? I tried #vim but didn't get a response

0:52 vIkSiT: TeXnomancy, hmm, when using a :require :as ..

0:52 shouldn't something like (def v (db.recordname. (args))) work?

0:53 TeXnomancy: vIkSiT: it'd be db/recordname

0:53 vIkSiT: TeXnomancy, http://paste.lisp.org/display/111416 for instance

0:53 in both cases (/ or .) gives me a "class not found"

0:54 either (td.TupleDesc. (ref []))

0:54 either (td.TupleDesc. (ref [])) or (td/TupleDesc. (ref []))

0:55 tomoj: I think you have to import the class nowadays

0:55 vIkSiT: oh.

0:55 tomoj: the code that generates a constructor function seems to be commented out

0:55 (well, and you wouldn't be calling the constructor function even if it were there..)

0:55 TeXnomancy: right; java classes must be brought in with import rather than require/use

0:55 vIkSiT: tomoj, you mean code in my paste?

0:56 tomoj: huh

0:56 vIkSiT: I'm not using any java classes here..

0:56 tomoj: yeah you are :(

0:56 vIkSiT: oh darn

0:56 gen-class

0:56 tomoj: no, just defrecord

0:57 vIkSiT: oh I see

0:57 tomoj: note also your "Foo." syntax which is for java class constructors

0:57 vIkSiT: (I didn't realize that actually)

0:57 good point

0:57 tomoj: wonder why the constructor functions disappeared, though?

0:58 because it makes it impossible to refer to the class, maybe?

0:59 vIkSiT: tomoj, so in this case, how would do an import/use that namespace's records and protocols?

1:00 for instance, I can already do (:require [cljsimpledb.tupledesc])) and then do : (cljsimpledb.tupledesc.TupleDesc. (ref []))

1:00 which works fine

1:00 but that is *long*!

1:00 tomoj: (:import cljsimpledb.tupledesc.TupleDesc) I assume

1:02 vIkSiT: ah thanks. that seems to work

1:09 tomoj: I wonder if it would be nice to have a protocol for functions

1:10 so that your types could be callable

1:10 instances of your types I mean

1:14 quotemstr: Does clojure have anything like CL's EVAL-WHEN or COMPILE-TIME-VALUE?

1:15 tomoj: why isn't compile-time-value in the clhs?

1:15 quotemstr: err, LOAD-TIME-VALUE.

1:15 C-T-V is an SBCL extension.

1:16 tomoj: ah

1:17 what exactly are you trying to do?

1:18 quotemstr: I'm not trying to do anything in particular --- I'm just trying to get a feel for the difference between CL's evaluation model and Clojure's.

1:18 tomoj: a conditional that checks whether you're AOT compiling or something?

1:18 oh, I see

1:18 all I know is that it's different :)

1:18 I was hoping to get a feel as well

1:19 TeXnomancy: there's something like *compiling-files*

1:19 ,*compile-files*

1:19 clojurebot: false

1:19 quotemstr: non-toplevel defmacro seems to be meaningful.

1:19 TeXnomancy: that tells you whether you're in an AOT run or not

1:19 quotemstr: Which is fine.

1:21 tomoj: I guess we just have load-time and AOT-time?

1:21 quotemstr: That's interesting --- defmacro seems to be lexically scoped?

1:21 (do (bar) (defmacro bar [] 81))

1:21 Err, nevermind.

1:22 tomoj: TeXnomancy: you're not an impostor, are you? :)

1:23 vIkSiT: hehe

1:23 TeXnomancy: tomoj: this is my "I forgot to connect to dircproxy" fallback nick.

1:23 tomoj: ah

1:23 defn: I'm pasta.

1:23 vIkSiT: you mean you're toast?

1:24 quotemstr: TeXnomancy: You can ghost yourself.

1:24 defn: vIkSiT: precisely.

1:24 TeXnomancy: quotemstr: except my dircproxy is set to auto-reconnect

1:24 if I weren't lazy I'd just quit and connect to that instead.

1:25 quotemstr: TeXnomancy: nickserv has something for that actually.

1:25 TeXnomancy: oh?

1:27 quotemstr: Hrm, I could have sworn it had some kind of lock-unlock feature; maybe I'm thinking of a different IRC network.

1:27 defn: i know on slashnet you could ghost and then recover

1:27 or ghost, release

1:27 or something

1:32 vIkSiT: fn doest support ghosting, quotemstr

1:32 does*

1:33 btw, what kind of frameworks do you guys use to test code?

1:34 defn: in clojure i assume?

1:34 most peopple from what i read and hear use clojure.test -- stuart sierra is working on lazytest, but IMO it is largely unusable still

1:35 vIkSiT: ah thanks, i'll check

1:36 mabes: yeah, clojure.test is the standard for now.. I've used circuspec on some projects, but that will be going away once lazytest is done

1:36 er.. circumspec

1:37 defn: lazytest gets some Friday love due to friday open source day or something at think relevance

1:37 Scriptor: what's Friday open source day?

1:44 defn: so once a week ytou can count on some form of progress :)

1:44 Scriptor: they have some sort of company policy where they can work on open source stuff on Friday I believe

1:45 kind of like Google's 20% of your time if your own development time

1:45 (I think that's the %)

1:45 Scriptor: so if you release your own os project you could work on it, and not have to worry about the company trying to say it owns any part of it?

1:49 defn: I don't work there so I don't know

1:49 I'm just telling you I know they have something like that on Fridays

1:50 I've always been under the impression that they are a pretty non-evil company, but I suppose they could claim they own your stuff if they wanted to squander good will and be a bunch of jerks...

1:52 Scriptor: this is relevance, right?

1:53 vIkSiT: hmm this is weird. So I've got 2 namespaces: a and b. Each has a protocol declared, with a function called to-string in both protocols

1:54 in namespace a, I do a (:use) for namespace b

1:54 defn: Scriptor: i think that's who stuart sierra works for. i really can't tell you anymore than i have

1:54 it was in a 140 character tweet. i know nothing more.

1:54 vIkSiT: and end up getting: "error: java.lang.IllegalStateException: to-string already refers to"...

1:55 so I'm in another namespace, and am referring to namespace a's functions using the full notation - and this still happens?

1:57 tomoj: uhh

1:57 if you have a protocol in namespace a with a to-string, you shouldn't :use namespace b which also has a to-string..

1:58 vIkSiT: tomoj, hmm the problem is that the method you suggested earlier (import) - causes issues - I get messages saying that a particualr fn isn't defined for that protocol in the corresponding record

1:58 tomoj: you need to import the class to get the constructor, you must require or use to get the protocol fns

1:58 and you can't :use namespace b in namespace a

1:59 vIkSiT: hmm. So, import for protocols, and then do a : use to get the functions - wouldn't that imply using having to use ns b in a?

2:00 tomoj: if you've got a/to-string and b/to-string, a can't :use b..

2:00 vIkSiT: then :require?

2:00 tomoj: that should work

2:01 you could also :use :rename I suppose

2:01 vIkSiT: ah thanks for the pointer. ns's and protocols are taking some time to wrap my head around :)

2:01 so much easier with defstructs

2:01 tomoj: defprotocol defines fns just like normal

2:01 vIkSiT: right

2:02 tomoj: so the fn names have to be unique per namespace, but ':use b' refers to everything in b directly

2:02 vIkSiT: right. so a use would make a direct reference, but a require would need a fully qualified reference?

2:03 tomoj: (ns ... (:require [foo.bar.baz :as baz])) (baz/my-protocol-fn)

2:03 vIkSiT: i see

3:39 LauJensen: Morning all

3:41 naeu: can someone explain the difference between rest and next, and perhaps also why rest is implemented as more()

3:45 tomoj: (doc rest)

3:45 clojurebot: "([coll]); Returns a possibly empty seq of the items after the first. Calls seq on its argument."

3:45 tomoj: (doc next)

3:45 clojurebot: "([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil."

3:45 tomoj: ,(next [1])

3:45 clojurebot: nil

3:45 tomoj: ,(rest [1])

3:45 clojurebot: ()

3:46 LauJensen: naeu: where is more() defined?

3:47 tomoj: RT.java L567

3:48 then in whatever seq classes

3:50 ASeq has a more which defers to next() and then special-case returns () if next returns nil :)

3:50 naeu: LauJensen: more() is defined in ISeq

3:51 it's also called by the implementation of rest

3:51 which is in RT.java

3:52 LauJensen: ok

3:53 naeu: so is the difference between rest and next that next in the case of a one-element-seq, next will return nil whereas rest will return an empty seq

3:54 LauJensen: naeu: yea, just like the doc string says

3:54 tomoj: also (rest nil) is () while (next nil) is nil

3:54 similarly for empty seqs

3:55 naeu: which would enable nil punning with next

3:56 LauJensen: (when (empty? (rest c))) vs (when (next c))

3:56 naeu: yeah, for some reason I didn't read the documentation for next and rest, I just went straight to the implementation

3:56 then got confused by more()

3:59 LauJensen: I think there's also a lazy/eager concern, but I forget if thats changed in the current implemented, do you remember tomoj ?

3:59 tomoj: I don't think we're supposed to use nil-punning anymore anyway

4:00 I only learned about the lazy/eager issue a few moments ago reading http://clojure.org/lazy

4:00 unfortunately it doesn't explain the issue

4:01 LauJensen: It sorta does, in that next gives a "possibly delayed path" to the remaining items. I think the call to seq preserves laziness while nil evaluation doesnt

4:03 tomoj: "possibly delayed path"?

4:05 LauJensen: lazy?

4:05 clojurebot: lazy is hard

4:05 LauJensen: how?

4:05 clojurebot: with style and grace

4:05 LauJensen: who?

4:05 clojurebot: who is x

4:06 tomoj: since next is implemented in terms of rest, I don't see how next could be less lazy

4:06 er, I mean, rest is implemented in terms of next

4:06 basically

4:07 LauJensen: If its not explained by the call to seq I dont know, but I dont have time to look at the source just now

4:07 tomoj: you mean (next aseq) == (seq (rest aseq)) ?

4:08 that call to seq, I mean?

4:08 LauJensen: tomoj: According to the doc you linked, next wraps its argument in seq

4:08 tomoj: so does rest

4:09 naeu: tomoj: I don't see how rest is implemented in terms of next

4:09 unless all the persistent data structures do that

4:09 tomoj: see for instance ASeq.java L115

4:10 naeu: next maps onto ISeq#next() and rest maps onto ISeq#more()

4:10 hoeck: rest is more lazy than next, see , see http://gist.github.com/437419

4:10 naeu: and then it's up to the implementations to implement these methods as they see fit

4:10 tomoj: yes, I should've said only ASeqs

4:11 naeu: does anyone know why Rich chose the method name more()?

4:11 Chousuke: it was to be the name of the function

4:12 but then it changed, and the method didn't :P

4:12 tomoj: hm... LazySeqs aren't ASeqs

4:12 am I right that for ASeqs, rest is no more lazy?

4:12 err

4:13 that doesn't even make sense, does it? :)

4:13 Chousuke: the default implementantion maybe

4:13 tomoj: are any ASeqs lazy?

4:13 Chousuke: No idea. :)

4:14 well, I mean, all seqs are lazy, it just varies how lazy :P

4:14 tomoj: PersistentVector$ChunkedSeq is an ASeq, and I guess it's somewhat lazy?

4:14 Chousuke: yes.

4:15 tomoj: I can't think of a way to test rest vs next on them though

4:16 oh well.. so rest in lazy-seq, next everywhere else, and always something like (when (seq s)), yes?

4:16 mmarczyk: ,(rest [1])

4:16 clojurebot: ()

4:16 mmarczyk: ,(next [1])

4:16 clojurebot: nil

4:16 mmarczyk: so that's one difference

4:16 tomoj: I meant whether rest is more lazy on them

4:16 mmarczyk: morning :-)

4:16 what would that mean?

4:16 tomoj: I don't even know

4:16 mmarczyk: they're produced in chunks anyway, which is good for memory

4:17 tomoj: less chunking when you next up to a boundary or something

4:17 mmarczyk: but if your vector holds "actual elements", as it will

4:17 less chunking, hm

4:17 tomoj: dunno how to detect a chunk being produced

4:18 er, one would expect next to cause more chunking at a boundary, I guess, if there is in fact any difference

4:18 LauJensen: chunks are evil, hopefully they'll go away soon

4:19 tomoj: to be replaced by cells, or..?

4:19 LauJensen: Exactly

4:19 mmarczyk: tomoj: actually chunkMore for a vector is implemented in terms of chunkNext

4:19 LauJensen: Rich has also made some nice prototypes, that worked better than chunks, without the evil

4:19 mmarczyk: the difference being that chunkMore returns () at the end

4:19 that's chunkedMore

4:20 tomoj: I still have no idea what cells are

4:20 who calls chunkedMore?

4:20 mmarczyk: tomoj: that's because they are a transient concept at this time, you can't properly hold onto it ;-)

4:20 LauJensen: They are a mutable construct, a little similar to cells, but where concurrency is handled through locking - Because they are low on allocation, they perform even better than chunks. Rich has implemented map and filter et al using cells

4:21 s/to cells/to transients/

4:21 sexpbot: They are a mutable construct, a little similar to transients, but where concurrency is handled through locking - Because they are low on allocation, they perform even better than chunks. Rich has implemented map and filter et al using cells

4:21 tomoj: ah, so the "sentry" is some thing you can pass in which decides how to handle the locking?

4:21 LauJensen: maybe :)

4:21 tomoj: heh

4:23 mmarczyk: tomoj: PersistentVector's implementation of next calls chunkedNext

4:23 not sure who calls chunkedMore, to be honest

4:23 tomoj: :)

4:23 dead code?

4:24 mmarczyk: clojure.core/chunk-rest

4:24 tomoj: aha

4:24 Raynes: http://www.reddit.com/r/programming/comments/cejxa/scala_for_hackers/c0s0y3j Is this a true statement?

4:24 mmarczyk: also see gvec.clj, there's one more call in there

4:24 Raynes: $(iterate inc 0)

4:24 sexpbot: java.lang.NoClassDefFoundError: clojure/core$iterate$fn__3752

4:24 Raynes: That's weird.

4:24 LauJensen: Raynes: 2/3 of the way, yea

4:25 Raynes: Looks like a clj-sandbox bug. I'll have to scream at Licenser about it later. There is a similar problem with rseq.

4:25 $(rseq [1 2 3])

4:25 sexpbot: java.lang.NoClassDefFoundError: clojure/lang/APersistentVector$RSeq

4:25 Raynes: LauJensen: Thanks for letting me know.

4:25 mmarczyk: Raynes: what does that "has better performance" mean? better than what?

4:26 or is there no context

4:26 Raynes: mmarczyk: I remember back in '08, gnuvince was a Clojure guy who whined about performance a lot. He made blog posts about it. Then he stopped using Clojure and started using Scala. There is no context here, though.

4:26 mmarczyk: ah, I see, sorry -- picked the wrong link

4:26 not fully awake yet.

4:27 Raynes: Better performance than "Scala".

4:27 Sorry, I thought he mentioned that.

4:27 If that's the context you mean't, anyway.

4:27 mmarczyk: yeah, thanks

4:27 Raynes: meant*, I hit permalink and shot away. :p

4:27 mmarczyk: :-)

4:28 funny how everyone seems to believe that starting with Scala is easier on account of it being vaguely similar to Java :-P

4:28 no worries at all about the most complex type system on Earth? :-)

4:28 tomoj: most complex? scala?

4:29 mmarczyk: well, isn't it?

4:29 Raynes: I don't know Java though. Clojure was more familiar to me when starting with JVM languages.

4:29 eevar2: hmm.. he seems to claim that scala has better performance than clojure

4:29 LauJensen: mmarczyk: not vaguely similar, its like javas twin brother with a 3.rd arm

4:29 Raynes: I was under the impression that you could get near-Java performance with type-hint trickery and such.

4:29 mmarczyk: I wouldn't want to comment on the performance difference, don't know about Scala in practice

4:29 Raynes: There is no way in hell that Scala is as fast as Java, anyway. People would be bragging about that.

4:30 So I'm not certain.

4:30 LauJensen: Well - I think its premature to discuss compiler speeds when Scala programs are still 2x as verbose as Clojure programs

4:30 mmarczyk: LauJensen: hm :-)

4:30 Raynes: actually I thought that people were in fact bragging about that :-)

4:30 LauJensen: I got heavily flamed by some Scala dude for suggesting that Scala programs where 3x as verbose, because after he had fine tuned the program, it was only 2x as verbose

4:30 Ok - I admit it publicly, Scala is only twice as verbose :)

4:30 mmarczyk: no links though, so maybe I'm dreaming it

4:31 tomoj: mmarczyk: more complex than haskell?

4:31 Raynes: mmarczyk: I don't think I've ever heard that. I've heard both language's brag about "near-Java performance".

4:31 mmarczyk: tomoj: I'd have thought so

4:31 tomoj: mmarczyk: does scala have a monomorphism restriction?

4:31 :)

4:31 * Raynes lols

4:31 mmarczyk: tomoj: sorry, not a Scala expert, wouldn't want to comment

4:31 :-)

4:32 also, for Haskell it's an implementation issue

4:32 and *also*, I don't see that it adds that much in the way of complexity :-)

4:32 Raynes: Would anybody have use for Clojure bindings for the Github API? :o

4:32 LauJensen: Raynes: Nope, but I did wrap git once

4:33 Anywaay, gotta jet, its on Github if you want it

4:33 mmarczyk: LauJensen: good to know about the 3x -> 2x thing, my right wrist is every so slightly less worried about possibly writing Scala :-)

4:33 have a good day

4:33 (ever so slightly)

4:33 Raynes: I'm asking because I'm not too far off from having implemented the entirety of the Github API. It's going to include the Gist API as well.

4:34 I've kept it under the covers so that people wouldn't use it until it was done.

4:34 :>

4:34 I probably have 10 thousand uses for it in sexpbot.

4:34 A friend has already started implementing a repo watcher, last I heard through sexpbot radio.

4:34 mmarczyk: Raynes: how about a "gist this session" link in Clojure REPL?

4:35 Raynes: mmarczyk: Possibly. Might have to talk with chrisdone about that one though.

4:36 tomoj: I have kind of wanted to try c&c in clojure

4:36 Raynes: Speaking of that, I might ought to work on getting my local changes working. Me and Chris broke it a couple of days ago. :p

4:40 LauJensen: Sorry for the OT: A few months ago, somebody posted this cool webapp on HN, where you picked a color, and it would generated all shades of that color, appropriate for a color-scheme - anybody got the link? :)

4:45 mmarczyk: http://alexpogosyan.com/color-theme-creator/

4:45 LauJensen: you mean this one?

4:46 LauJensen: No - It was for website design

4:46 mmarczyk: ah.

4:47 http://colorschemedesigner.com/

4:47 ?

4:47 LauJensen: another link for you

4:47 LauJensen: No - Though I might try that, since all links seem to go back. This other one was nicely designed, and you just picked a color, and you would get a looong vertical list of the shades and their code, but thanks :)

4:48 mmarczyk: hm, sounds cool

4:48 LauJensen: It was - And it picked great shades

4:49 tomoj: do you think clojure is doomed for real-time music performance because of the JVM?

4:49 LauJensen: define music performance? Playing, sampling, mixing, what ?

4:50 tomoj: yes

4:50 :)

4:50 something like Max/MSP say

4:50 except without all the graphical programming bullshit and in clojure

4:51 LauJensen: I would be very surprised if Clojure couldnt handle that

4:51 TakeV: I've been using it for game programing.

4:52 tomoj: can't have a train wreck because of GC :(

4:52 LauJensen: tomoj: The GC is also subject to tweaking

4:52 mmarczyk: LauJensen: last one for now: http://www.neteffect.dk/colormatch/ -- found it here: http://www.bestdesigntuts.com/20-color-tools-for-designers/

4:53 tomoj: I found a paper about some crazy IBM JVM that does AOT compilation to machine code and uses a special garbage collector to achieve 5.0+-0.75ms keyboard-to-speaker latency

4:53 mmarczyk: tomoj: whoa, cool :-)

4:53 LauJensen: tomoj: Cliff Clickyti Click has a pauseless GC running on Azul

4:54 mmarczyk: alright, got to go for now

4:55 tomoj: mmarczyk: sounds more scary and difficult to work with than cool to me :(

4:55 LauJensen: mmarczyk: ok, thanks

4:55 naeu: tomoj: have you seen overtone?

4:56 tomoj: http://rosejn.github.com/overtone/ that?

4:56 no, thanks

4:56 the blurb there sounds like exactly what I want :)

4:57 LauJensen: "does everything in half the time with no latency"

4:57 perfect!

4:57 tomoj: LauJensen: that's azul? or?

4:57 LauJensen: Just referring to the sales pitch which sucked you into naeu project :)

4:57 tomoj: ah, heh

4:58 LauJensen: mmarczyk: this was it: http://0to255.com/

4:58 naeu: LauJensen: what sales pitch?

4:58 LauJensen: 'which' sales pitch you mean, this:

4:59 <tomoj> the blurb there sounds like exactly what I want :)

4:59 naeu: LauJensen: you're being very pedantic today

4:59 LauJensen: Why thank you :)

4:59 naeu: I don't need my grammar corrected in IRC

5:00 LauJensen: Actually you do, but I will respect it if you're not ready to recognize that fact yet :)

5:00 naeu: I'm just throwing words out, not curating a precise essay

5:01 well, each to their own opinion

5:01 I prefer not to correct people's grammar unless they ask me to or I'm pretty certain they'd appreciate it

5:02 LauJensen: hehe

5:02 naeu: but seriously, I've not seen a better music framework than SuperCollider

5:03 it's basically a linguistic version of Max/MSP

5:03 LauJensen: naeu: If you'd prefer me to not comment, I'd be happy to restrain myself. Though I think generally people today are sooo sensitive to critique, which is why most people go an entire lifetime without learning anything meaningful. No harm intended I assure you

5:03 tomoj: "an interpreted object-oriented language"

5:03 fail

5:03 :P

5:04 LauJensen: you split your infinitive :O

5:04 LauJensen: tomoj: where?! :)

5:04 mmarczyk: LauJensen: thanks for the link, that is really cool :-)

5:04 LauJensen: mmarczyk: np big guy

5:04 tomoj: "to not comment"

5:05 just kidding :)

5:05 naeu: LauJensen: I understand your point, it's just important to realise that when giving critique it's easy to come across as pedantic/arrogant/imperious rather than helpful

5:05 LauJensen: naeu: So you're saying that its the way I presented the critique, instead of your level of sensitivity? How could I have done better?

5:06 tomoj: naeu: shit thanks for pointing me at overtone

5:06 this is great

5:06 naeu: no, I'm not making such an explicit distinction, I'm just saying it's important to realise that both the presentation and the context of the critique are worth considering

5:07 tomoj: I agree, it really is great

5:07 LauJensen: naeu: I agree

5:07 naeu: tomoj: in fact, I believe it so much I'm going to dedicate next year to working with it

5:08 tomoj: is someone gonna pay you?

5:08 naeu: tomoj: sort of

5:08 I'm going to start a research project at Cambridge University

5:11 tomoj: oh, nice

5:12 good luck

5:12 naeu: tomoj: thanks

5:12 LauJensen: naeu: What was topic of your project?

5:12 naeu: LauJensen: What 'is' the topic of my project? ;-)

5:12 sorry, couldn't resist

5:12 LauJensen: HOW DARE YOU! PEDANTIC !"%!"%

5:12 No Im just kidding, thanks for pointing it out to me :)

5:13 naeu: :-p

5:13 The project is entitled improcess

5:13 which is a conflation of improvisation and process

5:14 I'm exploring the potential of using formalised process to enhance our ability to improvise electronic music

5:14 tomoj: my feeling was that I probably want to write all the clojure ahead of time and have it expose controls

5:14 agree?

5:14 naeu: I'm going to combine live coding with the use of external interfaces such as 3D mice and monomes

5:14 tomoj: well, I mean, I guess it's obvious that you're not going to be writing clojure live :)

5:14 oh, live coding? you're a better coder than I, then

5:14 naeu: tomoj: actually I am going to be writing clojure live

5:14 tomoj: I'm jealous if you can get your hands on monomes

5:14 LauJensen: naeu: Oh - Like making a process which produces creativity?

5:15 naeu: or at least some internal DSL on top of raw clojure

5:15 LauJensen: tomoj: he can, he's already got a 3D mouse :)

5:15 naeu: LauJensen: perhaps, although I don't want to replace the human. Rather, I want to augment the human with extra powers with which to express his/her creativity

5:15 LauJensen: Yea exactly - Sounds like a lot of fun

5:16 naeu: it should be

5:16 :-)

5:16 tomoj: actually I have 3 monomes

5:16 a 64, 128 and a 256

5:17 I'm most fond of my 64 right now because it's bus powered and fits snugly in my satchel

5:17 I've already written Clojure drivers for my 3D mouse and the monome

5:18 but I'm still learning a lot of basic stuff to make it all happen

5:18 although I am making a lot of progress

5:18 right now I'm workign through JoyofClojure whilst working through the Clojure source

5:18 very interesting stuff

5:18 I'm hoping to be already running when I start in Sept

5:19 tomoj: naeu: awesome!

5:19 I would _love_ to hack clojure + monome

5:19 naeu: yeah, it's good fun :-)

5:19 have you thought of building your own ardiunome?

5:29 tomoj: I haven't..

5:29 I have a duemilanove

5:30 I'd seen some recent stuff on planet clojure about arduino+clojure, but it seemed like it only worked when tethered to the computer

5:30 of course for music this is no problem

5:30 naeu: oh nice

5:31 I think it's such a shame the JVM doesn't ship with a raw socket library

5:33 LauJensen: *geeks* :)

5:33 naeu: of course :-)

5:36 tomoj: I'd really like to try sewing some lilypads onto LED gloves and hacking that in clojure, but I think it's impossible :(

5:36 LauJensen: ?!

5:36 tomoj: there's some haskell lib that provides a dsl that can generate arduino code, and I guess you could do that in clojure, but it sounds nasty

5:37 ?!?

5:37 LauJensen: lily pads? LED gloves?

5:38 naeu: sounds cool

5:38 although i've never heard of lily pads

5:38 do you have a link?

5:38 tomoj: http://www.arduino.cc/en/Main/ArduinoBoardLilyPad

5:39 nipra: ,(do (declare foo) (defmulti bar foo))

5:39 clojurebot: DENIED

5:39 tomoj: LauJensen: LED gloves are just gloves with LEDs in the fingertips

5:39 LauJensen: yea ok, now it makes more sense - I thought you meant the flower :|

5:40 naeu: ah nice

5:40 so much cool stuff, so little time!

5:40 tomoj: :)

5:41 nipra: Why does (do (declare foo) (defmulti bar foo)) throw unbound var error while (do (declare fred) (defn barney [] (fred))) doesn't?

5:43 tomoj: defmulti does stuff with the dispatch-fn

5:44 defn doesn't try to use fred until you call it

5:45 nipra: tomoj, hmm.. Ok. Thanks.

5:53 mmarczyk: tomoj: re: Clojure & Arduino: http://github.com/hayamiz/kondo-lisp

5:54 there's also a number of posts on nakkaya.com

5:55 tomoj: yeah, saw this kondo-lisp thing on planet clojure, but the README is intimidating :)

5:55 mmarczyk: yeah, FIXME: write sounds scary :-)

5:56 tomoj: and I would need to not be tethered, which pretty much means either 1) the arduino runs clojure (impossible?) or 2) clojure generates arduino code (nasty?)

6:01 LauJensen: 2) doesnt have to be nasty - Penumbra generates C with much success

6:07 tomoj: hrmm

6:07 that would probably be more attractive if I knew C

6:09 LauJensen: Well you know macros right? Zach has made heavy use of them to let Clojure write many of its own functions - The approach is identical for Arduino

6:10 tomoj: yeah, sounds worth looking into, thanks

6:11 mmarczyk: good night (ugt) for now, bbl

6:12 LauJensen: see u

6:17 Raynes: Real Lispers don't sleep.

6:23 LauJensen: Thats why they're so grumpy all the time. Clojurians sleep at least 5 hours per night :)

6:42 squidsoup: wow just discovered http://sicpinclojure.com/ .. awesome idea

6:44 Raynes: $(filter identity [1 2 3 "omg" nil true false])

6:44 sexpbot: => (1 2 3 "omg" true)

7:18 candera: Good morning #clojure

7:18 DarthShrine: Hi candera

7:18 Raynes: Morning.

7:19 candera: Watched a stealth bomber fly over my house last night. That was cool.

7:20 eintr: not very stealthily of it.

7:20 candera: You're the third person to make that joke. ;)

7:20 eintr: *snare* ;)

7:40 defn: I really don't know how I feel about Clojurians versus Clojurists

7:40 opqdonut: Clojurers

7:41 defn: That is just wrong. :D

7:41 opqdonut: :)

7:41 i think it's fun how it's a bit like conjurers

7:41 LauJensen: defn: You dont need to feel anything, Rich said 'Clojurian' :)

7:41 eintr: cloji?

7:41 LauJensen: But thats for the hardcore. if you're just a tourist in Clojure, then Clojurist is best

7:42 eintr: clojeur?

7:42 defn: eintr: i like that

7:42 cloji, like magi

7:43 the ability to read stars, and manipulate the fate the stars foretold

7:43 sounds pretty accurate :)

7:43 eintr: clojeurs have an....uhm... unhealthy... relationship with persistent vectors.

7:43 squidsoup: "A computational process is indeed much like a sorcerer's idea of a spirit. It cannot be seen or touched. It is not composed of matter at all. However, it is very real. It can perform intellectual work. It can answer questions." -Gerald Sussman on scheme, SICP

7:44 Clojurer is kind of cool

7:44 defn: clojeurs are people who get all tingly when they see a really complicated destructuring

7:46 clojurati

7:46 aka rich and chouser

7:46 Raynes: Clojurian is canonical. All else is blasphemy.

7:47 * defn searches OED for a mention of Clojurian

7:48 Lajla: eintr, one of the things I noticed too

7:48 the use of vectors where I would use lists.

7:48 defn: clojurian is good and all, but i have a hard time keeping a straight face when saying it out loud to someone who isn't part of the clojure community

7:49 i cant think of another programming language which contains -ians

7:49 Lajla: I am an exchange student, plus, I was banned from #scheme for off topic holocaust denial legalisation advocacy.

7:49 squidsoup: hah

7:49 defn: lispers, rubyists, pythonistas -- no -ians to be found

7:49 Raynes: defn: I can't think of a programming language that is Clojure, as well.

7:50 defn: i dont see how that follows

7:50 eintr: Lajla: you need to put that on a t-shirt

7:50 squidsoup: schemers have the best collective noun

7:50 Raynes: defn: And you feel perfectly serious saying "Pythonista" out loud?

7:50 Lajla: eintr, what?

7:51 I want a t-shirt with tail-call-optimization))))))))))))))))))))))))))))))))))) on it

7:51 defn: haha

7:51 eintr: Lajla: re banned from #scheme.

7:51 Lajla: eintr, ahh

7:51 squidsoup: ok here's a related joke.. What do you call a group of Haskell programmers?

7:51 defn: i dont know, what?

7:51 Lajla: well, to be honest, I asked some strange quaestions there too that were beyond any practical use.

7:51 A type class?

7:51 squidsoup: Category theorists

7:52 defn: hehe

7:52 Lajla: What's the difference between an introvert and an extravert mathematician?

7:52 defn: ?

7:55 Is that the punch line?

7:55 Lajla: defn, the extraverted looks at _your_ shoes when you talk.

7:56 defn: hah, I've heard that one somewhere

7:56 squidsoup: clearly Lajla's joke engine is written in ruby

7:56 Lajla: squidsoup, explain

7:56 My joke engine is written in Scheme

7:56 squidsoup: your punchline took a long time to process :P

7:56 defn: he's poking fun at Ruby's 1.8.X performance woex

7:56 woes*

7:56 most of which have been fixed in 1.9.X

7:56 squidsoup: oh don't get defensive, ruby's lovely :)

7:57 Lajla: Ruby suuuuuuuuuuuqqqqhhz

7:57 defn: <--former rubyist

7:57 Lajla: squidsoup, I was reading a mail, pardon

7:57 Ruby is a crippling asset to the mind.

7:57 Raynes: Lot's of Clojurians are former Rubyists. I've seen people hung for less.

7:57 defn: Aw, that's not true -- I bet I can rapid prototype faster'n'you

7:58 Lajla: I don't like this 'principle of least surprise'.

7:58 eintr: Lajla: dude, you can't just run off and do chores before delivering a punchline. that's so andy kaufman.

7:58 defn: it applies to clojure as well I think -- not a lot of surprises

7:58 I don't see why you'd ever want to be surprised

7:58 squidsoup: Raynes: I'm a ruby developer, so presumably I'm allowed to poke fun at it

7:58 Lajla: It cripples programmers minds, they should in stead be trained in the fact that a machine follows logic dumbly and thus can be surprising to human intuition

7:59 Well, in Scheme (= 0.1 1/10) ===> #f

7:59 SOme would call that a 'surprise'.

7:59 defn: Lajla: You're friends with Djikstra, aren't you?

7:59 Raynes: defn: If you lead a dull and predictable life, you need a little excitement in your code, I guess. :\

7:59 Lajla: defn, oh yeah.

7:59 Chousuke: Lajla: that's just silly

7:59 Lajla: Dijkstra was da bomb.

7:59 LauJensen: Lajla: I've processed the logs for #clojure and the result is, that you need to check out #clojure-casual :)

7:59 Lajla: Chousuke, moi, miten menee?

7:59 * defn takes a few cautious steps backward

7:59 Chousuke: Lajla: a machine is designed my people; it doesn't need to do stupid things

8:00 Raynes: LauJensen: Don't direct him there! :(

8:00 LauJensen: ?!

8:00 Raynes: LauJensen: He might actually come. ;)

8:00 Lajla: I rather have programmers be trained to understand that logic can be very counter intuitive than for programming languages to have a lot of exceptions to a general logic to make it easier for people.

8:00 Chousuke: Lajla: that is, if a program can do something that people would expect it to do instead of doing something completely different, doing the expected thing is often better.

8:00 squidsoup: well, I'm off to bed.. just wanted to spread a little joy after discovering the SICP in Clojure rewrite

8:00 great initiative

8:01 Lajla: I've seen peoplle that have 6 years of experiencing coding in Java that still did not realize exactly why they used == in conditionals.

8:01 squidsoup: night Clojurers and Clojurians

8:01 defn: Re: Djiskstra -- "On the fact that most software is written on one side of the Atlantic Ocean" --Alan Kay

8:01 Chousuke: Lajla: "exceptions" do not adhere to the principle, do they? :/

8:01 defn: ciao squidsoup

8:01 Lajla: Chousuke, in the case of programming languages, exceptions often contradict axioms.

8:01 Which were stated otherwise

8:01 and thus in effect were not the true axioms.

8:02 defn: Lajla: that's a 100 level CS course or an intro to symbolic logic course

8:02 Chousuke: Lajla: if a result of something is exceptional or incoherent, other things considered, then it's not the "least astonishing" thing

8:02 Lajla: the true axiom would be 'except in the special case B, A applies' andnot 'A aplies'

8:02 Chousuke, human intuition and logic are two completely different things.

8:02 defn: if you call someone who uses == in their Java programs programmers, then my cat may also fit your definition

8:02 err without knowing what it does...

8:02 Lajla: defn, I said they didn't realize why they used == instead of =.

8:02 It's true.

8:02 Chousuke: Lajla: can you give a practical example?

8:03 Lajla: I mean, from a programming language

8:03 Lajla: Chousuke, for instance, the fact that a < b < c in many languages compares 1 to c or 0 to c is considered a 'surpirse'.

8:03 Even though it follows clearly out of the language specs, similarly to a * b + c for instance.

8:03 Chousuke: Lajla: right. yes.

8:04 Lajla: Python allows a < b < c, which is different to (a < b) < c

8:04 defn: This whole conversation is a but nerve racking simply because what surprises one person may be completely natural and what they'd expect

8:04 It's awfully subjective

8:04 Lajla: defn, that too.

8:04 defn: s/but/bit

8:04 Chousuke: Lajla: because that notation is familiar to anyone with basic knowledge of maths

8:04 Lajla: Which makes the 'principle of least surprise' an even vaguer concept.

8:04 Chousuke: Lajla: programming languages are tools for *humans*

8:04 Lajla: Chousuke, it's abuse of notation in mathematics though.

8:04 And that's one of the things, I don't thing programming languages should resemble mathematical textbook notation

8:05 Mathematical textbook notation is often ambiguous and laden with inconsistencies and abuses of notation. Not a thing you want for a programming language.

8:05 That's why I like S-expressions

8:05 defn: See: APL

8:05 Lajla: Erase all faults, start again

8:05 defn: :D

8:05 Lajla: defn, exactly.

8:05 Brilliant language, brilliant notation.

8:05 Chousuke: if anything, a programming language should error when it encounters a < b < c

8:05 Lajla: a < b < c is awkward, but (< a b c) i fine

8:05 is fine*

8:06 Chousuke: C's weird interpretation of that is even worse

8:06 Lajla: Chousuke, not if a < b returns an integer.

8:06 As in C.

8:06 Chousuke: Lajla: no, it makes no sense

8:06 Lajla: Why, it's a perfectly valid operation?

8:06 defn: Brilliant language, brilliant notation, awfully surprising when compared to every other language I've ever used.

8:06 Chousuke: Lajla: it's not conceptually valid

8:06 Lajla: Chousuke, it makes all sense, < is an operation int x int -> int

8:06 Chousuke, what's concept got to do with it?

8:06 Chousuke: Lajla: that's stupid

8:06 Lajla: It's just a symbol for an operation on integers.

8:07 Chousuke: but it's not an operation on integers conceptually!

8:07 Lajla: It could be $ or |@ or !!

8:07 It's just a symbol given to a certain operation

8:07 Chousuke: *no-one* would say that a > b > c makes sense in C

8:07 Lajla: Depends on what you want to do.

8:07 Say c is guaranteed to be 0 or 1.

8:07 Then it can make all the sense.

8:07 Chousuke: it goes through the compiler because C is stupid, but it makes no sense.

8:07 Lajla: What if c itself is the result of a < operation earler.

8:07 Chousuke: no, it's just bad code then

8:07 Lajla: int c = q < r

8:07 Chousuke: and still doesn't make sense.

8:08 Lajla: Chousuke, it makes all the sense and it can be used to build a program.

8:08 Chousuke: code that compiles doesn't mean it's code that makes sense.

8:08 Lajla: If c is guaranteed to be 0 or 1.

8:08 What is 'makes sense'.

8:08 Chousuke: something that makes conceptual sense.

8:08 defn: I lost track where we stopped talking about "surprises" and instead began a veiled discussion on purity

8:08 Chousuke: comparing truth values to integers does not make that.

8:08 Lajla: If c is guaranteed to be 0 or 1 then a > b > c can be used to effective results.

8:08 defn: They are very different discussions

8:08 Lajla: Chousuke, they aren't truth values.

8:08 THey're integers.

8:09 Chousuke: Lajla: yes. but it STILL doesn't make sense.

8:09 Lajla: to the programmer, they are truth values

8:09 Lajla: Chousuke, why not?

8:09 Then that's where you go wrong.

8:09 They're integers.

8:09 It's operations on integers.

8:09 It's an operator like * or +

8:09 Chousuke: Lajla: C imposes this idiotic equivalence between truth values and integers, but that's another thing

8:09 Lajla: Chousuke, a boolean is not a truth value.

8:09 It's just a datatype

8:09 defn: it is in my view

8:09 Chousuke: ... skflsdjlfkj

8:10 and pointers are just integers

8:10 and arrays

8:10 Lajla: Chousuke, nope, but pointers are arrays.

8:10 Chousuke: pointers are also integers

8:10 Lajla: integers and pointes are different

8:10 You can't multiply pointers

8:10 * defn 's head explodes

8:10 Lajla: And they are typed

8:10 a + 3 is a very different result depending on a is a pointer or an integer.

8:10 Chousuke: yes you can, just cast to int :P

8:10 Lajla: Chousuke, if you can cast that surely means that it's different?

8:11 Especially when you need it.

8:11 But yeah, an array is just a pointer.

8:11 Chousuke: the thing is, even if they are the same thing to the machine, they're still different to the human

8:11 Lajla: "string" is a pointer towards an 's' const char, statically allocated after which comes 't' ... and finally a 0 char.

8:11 Chousuke: and while it's sometimes useful, your boolean example in particular is completely idiotic

8:12 Lajla: Chousuke, to humans whose minds have been crippled by ruby yes.

8:12 Chousuke: Lajla: bah

8:12 Lajla: The root of all bugs is people that think in 'concept's rather than in atoms that perform transformations on data.

8:12 Chousuke: Lajla: I've never programmed in ruby. :)

8:12 no

8:12 defn: no one's mind is crippled by using another language

8:12 i can do math and logic the same as you after a year and a half of ruby

8:12 Lajla: Chousuke, learn to let go, 'concepts' don't exist, your program is a pipeline of transformations on data.

8:13 Chousuke: the root of all bugs is people not understanding what they're doing *and* programming langauges doing idiotic things like treating booleans as integers :P

8:13 Lajla: concepts do exist.

8:13 Lajla: existence is a concet.

8:13 concept*

8:13 defn: Lajla: Ruby very much works like transformations on data most of the time...

8:13 Lajla: Chousuke, naïve realism much?

8:13 Chousuke: Lajla: you're just being overtheoretical here.

8:13 Lajla: Chousuke, when you see a 'tree', surely you realize your mind just creates an abstraction and what's there are a pile of elementary particles?

8:13 Chousuke: Lajla: you axiomatically assert that the programming langauge is right and the human is wrong.

8:13 Lajla: Chousuke, I would not be Lajla if I were not.

8:14 Chousuke: Lajla: yes, and the tree exists.

8:14 Raynes: I was hoping this channel would never end up housing such comp.lang.lisp garbage. :\

8:14 Lajla: Chousuke, I don't even believe in 'right' or wrong. =P

8:14 _exterm: Lajla, if you want a language that is statically checking thoroughly enough to slap you in the face for a < b < c, use one. like Haskell ;-)

8:14 defn: Lajla: i think you're verging on hysterical realism

8:14 Lajla: Chousuke, naïve realist?

8:14 defn: fwiw

8:14 Chousuke: Lajla: what?

8:14 Lajla: defn, I am a mereological scepticist, yes.

8:14 serp_: O_O

8:14 defn: see: http://en.wikipedia.org/wiki/Hysterical_realism

8:14 Lajla: Chousuke, a naive realist is some one who believe things exist necessarily because they are perceived.

8:15 Chousuke: Lajla: just because a tree is a complex structure of cells and other things doesn't mean it's not a tree

8:15 Lajla: Or rather, does not quaestion the existence of and validity of perception.

8:15 Chousuke, it's a collection of subatomic particles.

8:15 Subatomic particles 'exist' because they can be defined.

8:15 Chousuke: Lajla: yes. also that.

8:15 Lajla: Trees are just abstractions

8:15 Chousuke: Lajla: and a million other things

8:15 Lajla: it's still a tre.

8:15 tree*

8:15 defn: Hysterical realism is typified by a strong contrast between elaborately absurd prose, plotting, or characterization and careful detailed investigations of real specific social phenomena.

8:15 Lajla: Chousuke, naïve realism is hard to maintain scientifically.

8:15 Chousuke: that it is one thing doesn't mean it also isn't another

8:16 Lajla: Chousuke, do you think there's a reason there's no objective way to test if something is a tree or not?

8:16 Chousuke: Lajla: I'm not saying our perceptions are always correct but you're saying they never are.

8:16 Lajla: of course it's not objective. But it can be reasonably defined.

8:16 Lajla: Or that philosophy has tried for 2 000 years to define such things as 'trees' or 'humans' but ultimately failed why it took physicists 2 months to define the concept of photon rigorously?

8:17 Chousuke: and why does that matter?

8:17 the concept of trees and humans are still extremely useful

8:17 Lajla: Chousuke, well, it's called naïve realism, and as it seems it's not some-thing that can be reconciled with materialistic science.

8:17 Chousuke: more so than the concept of photons, in many contexts

8:17 Lajla: Chousuke, that doesn't mean it exists or is true.

8:17 defn: it's another symbol

8:17 why do you need the definition to sleep at night?

8:18 Lajla: A lie can be very useful to believe, especially if the truth is either too complex or too frightening to handle.

8:18 Chousuke: Lajla: it's not a lie. it's a flexible definition

8:18 Lajla: Chousuke, it's an approxiation, if you like.

8:18 Chousuke: or that.

8:18 still, not a lie

8:18 Lajla: Chousuke, what is the difference between a 'flexible definition' and vagueness?

8:18 defn: Hubble's constant by your definition wouldn't be good enough

8:19 Chousuke: Lajla: vagueness is a concept that's applied when something is not defined in any useful way.

8:19 LauJensen: Chousuke: Lajla: Seriously, isnt this discussion perfect for #clojure-casual?

8:19 Lajla: Hubble's constant is defined rigorously, just not _found_ rigorously yet.

8:19 Chousuke: Lajla: the definition of a tree is useful

8:19 candera: +1

8:19 defn: probably a good idea...

8:19 candera: (that is) LauJensen: +1

8:19 defn: @Lau

8:19 Lajla: Chousuke, get into casual

8:19 Can't see you there here.

8:19 eevar2: or #clojure-blah

8:20 Raynes: For the record, Lajla has joined #clojure-casual.

8:20 Lajla: I have

8:20 Chousuke: I suppose I could join

8:20 Raynes: eevar2: #clojure-casual is an established channel.

8:20 eevar2: Raynes: okies. i'm thinking of #haskell-blah i guess

8:21 Raynes: eevar2: Indeed. psykotic created the channel a while back. He's disappeared, but he made me an op before his vanishing act.

8:47 Licenser: Raynes: I may protest, not everything is a sadbox bug this certenly isn't the iterate problem is clojurebots one

8:48 Raynes: Huh?

8:48 How is that not a bug? :o

8:49 Licenser: Raynes: it is one but not a sandbox one, since it works in a vanilla sandbox

8:50 Raynes: Oh yeah, I forgot. But it isn't a sexpbot bug either, thankyouverymuch.

8:50 It works on my local sexpbot, but not on your server.

8:50 Therefore, your server is the bug!

8:50 ;)

8:50 Licenser: works it with the same version of clojure or do you have a different one on the server?

8:51 Raynes: It should be the same version. There hasn't been a new snapshot in 6 days, and I've ran lein clean && lein deps recently locally and on your server.

8:51 So, I don't know what causes the bug. I gave up days ago.

8:51 rseq wasn't a big deal, but iterate borking is kind of seriously annoying.

8:51 Not your fault though.

8:51 Licenser: hmm hmmm

8:52 Raynes: I may just need to re-clone sexpbot or something.

8:52 :|

8:52 Licenser: hmm hmm hmmmm hmmm

8:52 or it is the java version it runs

8:52 Raynes: Java 6?

8:52 Or is it 7?

8:52 I run 6 locally.

8:52 Licenser: the default java runs java 7 since it is my playground

8:53 try to use java 6?

8:53 Raynes: How can I make it use 6? >.>

8:53 defn: Raynes: get thee a branch

8:54 Licenser: try to run it with /usr/jdk/jdk1.6.0_16/bin/java

8:54 Raynes: I run it via lein swank. I can't control what leiningen uses, sadly.

8:54 defn: Raynes: you can i believe

8:54 Raynes: orly

8:55 Licenser: *updates to the neewest java 7 snapshot*

8:57 Raynes: I can just run sexpbot via the ./sexpbot script to test it.

9:00 defn: do you just need to set java.library.path?

9:00 Raynes: Or I could just do that.

9:00 $(rseq [1 2 3])

9:00 sexpbot: => (3 2 1)

9:00 Raynes: Licenser: Yep, that was it.

9:00 defn: also Raynes consider using swank-clojure-project if lein swank wont honor the directive

9:01 Raynes: defn: Over ssh? I think not.

9:01 defn: i think they're functionally equivalent nowadays

9:01 oh, right

9:03 Raynes: If I had leiningen installed locally, I could just edit that.

9:03 But Licenser has it installed globally.

9:29 Licenser: Raynes: try ain?

9:29 Raynes: Licenser: Try what again?

9:29 Licenser: run swank again?

9:30 Raynes: Licenser: I just spent the last 10 minutes figuring out how to make my ~/bin/java take precedence over /usr/bin/java, just to run Java 6.

9:30 Licenser: Raynes: I updated java 7 to the newest version

9:30 Raynes: Doesn't mean it fixed the problem. :p

9:31 Licenser: it doens'T mean it doesn't

9:31 that is why I say try

9:31 bartj: tomoj: just learnt to do (rand-int num) instead of (int (random number))

9:31 duck1123: there is no try

9:31 bartj: tomoj: thanks to your code snippet above

9:31 Raynes: I guess. As soon as I figure out why I can't get in my screen session.

9:43 Bleh.

9:44 Lajla: ,(car [1 2 3 4])

9:44 clojurebot: :volkswagen

9:44 Lajla: Ahaha

9:44 ,(first [1 2 3 4])

9:44 clojurebot: 1

9:44 patrkris: If I have 20-30 minutes to talk about Clojure and Software Transactional Memory, what would be the most important stuff to include in your opinion? The audience will mostly be representatives from various small and large IT companies.

9:47 arkh: I'm sure you've seen it, but just in case, I'd cover what Rich did in http://blip.tv/file/812787

9:48 bartj: patrkris: this is the article I like best - http://java.ociweb.com/mark/stm/article.html - perhaps, it should help you?

9:49 Chousuke: patrkris: the ease of working with data that you can trust no to change, no matter what happens :)

9:49 not*

9:51 bartj: patrkris: I am sure you would have seen this wonderful presentation as well - http://docs.google.com/viewer?a=v&q=cache:9t4z3xYqYPMJ:java.ociweb.com/mark/stm/STM_1up.pdf+clojure+stm&hl=en&gl=in&pid=bl&srcid=ADGEESiSWzwW5jQM-xLSunwiXrk2i1EI0fkkY_rH6XYn0wt3EbW0coe9OBrX0zz1LlIKuOJku4-UeJFUaMPcwAV2CytmahRa9YORHf9cVpz6s5kmphrYHbfqMSCwh43u6oEhdGeUPDoW&sig=AHIEtbRMvwluDplu4bmPeAeucaAhBZYZBQ

9:52 patrkris: arkh: thanks for the suggestion, and yes, I have seen it. It's a pretty long video, and I have only got 20-30 minutes. I'm thinking about what could seem most important to these people. I don't expect anyone being familiar with Lisp and functional programming. In fact, I think most of them are pointy-haired bosses who chose 'safe technologies'. But I want somehow to convey my enthusiasm but leave them with an impression that Clojure *matters*. It's n

9:52 just another academic idiot trying to push an esoteric language down their throats.

9:52 bartj: i'll take a look, thanks

9:52 Chousuke: that's a good point

9:52 bartj: patrkris: this is a saner URL - java.ociweb.com/mark/stm/STM_1up.pdf - "Tackling Concurrency With STM"

9:53 patrkris: bartj: ah, thanks

9:53 Chousuke: patrkris: remember to mention that stuff can change unexpectedly even in a non-multithreaded program (eg. if you pass a reference to something to a function etc.)

9:54 patrkris: Just a little context: This presentation is held for a bunch of IT companies, as I said. It's done at my university, and it allows said companies to get a glimpse of what software engeering and computer science students are doing.

9:54 I don't expect any of the company representatives to really have a grasp about the importance of immutability and functional programming. But maybe I'll be surprised.

9:55 Chousuke: again, good point

10:04 arkh: patrkris: from the phb point-of-view, the future of hardware looks like it will be in the form of more parallelism, like many-core cpus. For developers to take advantage of that while avoiding the traditionally difficult problem of concurrency (maybe point out that most people are "doing it wrong" right now) they need the right tools. STM and specifically Clojure can provide those tools, on top of a JVM they may already have running on servers, leve

10:04 raging Java code they may have already developed or purchased.

10:05 *leveraging

10:06 patrkris: arkh: noted, thanks!

10:07 Chousuke: leveraging ;/

10:07 arkh: Chousuke: thank you : )

10:08 * Chousuke wonders what's wrong with utilising or "making use of" etc

10:08 patrkris: Chousuke: You have to remember that these are managers and bosses. They'll appreciate business-words like 'leveraging'.

10:08 :)

10:09 Chousuke: Although I'll give the talk in Danish - so it doesn't really matter for me.

10:09 arkh: you can't "make use of" synergies as well if you're not leveraging them. See, you make the stakeholders gather 'round the tribal knowledge, maybe taking it offline ...

10:09 ;P

10:10 patrkris: I wish I could just say something like 'Clojure will give you less headaches, and programmers will have more fun.'

10:12 arkh: coming from a non-functional background, clojure was painful at first. It's frustrating to be thrust back in time to when I didn't "get" how to program something. I'm thankful I continued with it, though. The effort was worth it by a lot.

10:12 patrkris: i feel exactly the same way

11:18 rrc7cz: how might you do (apply or [f f f f t])? I've tried something like (apply #(or %&) ..) but I'm missing something. It also doesn't accept a seq

11:18 does everyone just use reduce?

11:18 candera: Is there something wrong with reduce?

11:19 AWizzArd: rrc7cz: or is not a function, it is a macro, so you can't apply it.

11:20 rrc7cz: I understand

11:20 AWizzArd: And what are f and t?

11:20 rrc7cz: but then how would you do it?

11:20 true/false

11:20 it isn't literal code, just an example

11:21 I have (reduce #(or %1 %2) [true false false false]) right now

11:21 clojurebot: project euler is http://ProjectEuler.net

11:21 AWizzArd: rrc7cz: I would write: (some identity [false nil nil true false])

11:21 some is what you want

11:21 Your reduce is wrong.

11:22 candera: rrc7cz: I see the problem with reduce. No short-circuiting.

11:22 rrc7cz: AWizzArd,candera: is that the only prob with the reduce? no short circuiting? or did I miss something else?

11:22 AWizzArd: I like your solution

11:22 AWizzArd: some ==> or, every? ==> and, not-any? ==> (not (and ..)), not-every? ==> (not (or ..))

11:23 candera: Well, I'm the dumbest guy in the room (although hopefully by less each day), but that's the only problem I can see. :)

11:23 AWizzArd: reduce *can* be used to do what you want, but the function will have to be more complex

11:23 rrc7cz: ok

11:24 AWizzArd: can you give me a hint as to the problem? :-) just so I understand

11:24 chouser: no way to make reduce short-circuit

11:24 rrc7cz: I mean, if you assume for a moment short circuiting is not necessary; perhaps we just have a set of bools

11:25 chouser: even then, reduce will examine all of them, doing unnecessary work that 'some' would not

11:26 rrc7cz: okay makes sense

11:26 thanks guys

11:26 fogus: To make things a little clearer you can use (some #(or %)...) and (some #(and %)...)

11:27 chouser: wouldn't both of those do the same thing

11:27 ?

11:28 fogus: chouser: Shoot, you're right!

11:29 rrc7cz: I like the readability though

11:29 fogus: (every? #(and %) ...) is what I should have said

11:30 Although at that point clarity is subjective

11:30 rrc7cz: why doesn't some have a question mark?

11:32 fogus: rrc7ca: It's not a predicate

11:32 rrc7cz: just saw that, with the example (some #{:a} [:a :b])

11:45 arkh: what's the reason for this not returning a prompt at the repl:

11:45 (def counter (agent 0))

11:45 (await (send-off counter inc))

11:45 (prn @counter)

11:46 it's like the agent thread sits out there, not joining after send-off

11:46 jcromartie: it doesn't block for me

11:47 arkh: : (

11:47 jcromartie: using 1.2 built a few days ago

11:47 arkh: fwiw, using 1.1

11:48 puredanger: are there any guarantees that keys or vals will give me back the keys or vals of a record in the order of definition?

11:49 arkh: puredanger: no (with maps)

11:52 cemerick: well, records aren't maps

11:52 but no, there are not guarantees

11:52 puredanger: ^^

11:52 s/not/no

11:55 puredanger: I ask because I always seem to get back keys and vals in the order of definition for a record

11:56 and I could believe that if it's based on field ordering from a defined class that it *might* have a stable ordering based on that

11:57 maybe another way to phrase this would be to ask whether a record acts as a sorted map based on field definition order

11:57 either intentionally or accidentally

11:57 cemerick: puredanger: the ordering originates in the defrecord declaration, but it's certainly an impl detail

11:58 puredanger: if so, then it seems like the docs should make it clear not to rely on it

11:58 is there a way to reliably get the fields of a record in order?

12:00 I was also curious about doing (defrecord A [c b g]) and then (print (A. 1 2 3)) which yields #:user.A{:c 1, :b 2, :g 3}

12:00 cemerick: puredanger: looking at the impl, it'd take some bit of effort to make it so that the defined order isn't used for keys, seq, etc.

12:01 Why does ordering of the fields matter at all anyway?

12:01 That is, if they *do* matter, sort the map entries however you like.

12:01 rhickey: puredanger: I think the order of the base fields will become a guarantee

12:02 puredanger: fine, but how would I sort them based on definition order then :)

12:03 Licenser: I offer cookies!

12:03 puredanger: for reasons that are probably less than useful to explain (shaving a testing yak) I was trying to figure out how to take a record and produce a string that would construct that record

12:03 which is of course what I'd really want print to be doing for me more transparently

12:04 rhickey: puredanger: readable print for records is on the way

12:04 puredanger: and is #:user.A{:c 1, :b 2, :g 3} the form for that?

12:04 rhickey: if you are looking for introspection, try (keys arecord)

12:04 jcromartie: is there an overview on records on the site?

12:04 rhickey: puredanger: no, will be different then #:recordname{]

12:05 puredanger: rhickey: right, that's what drove the question about whether key order was stable wrt record field definition

12:05 rhickey: jcromartie: http://clojure.org/datatypes

12:05 jcromartie: thanks

12:05 rhickey: puredanger: will be yes, for the base keys

12:05 jcromartie: Is defstruct going away?

12:05 rhickey: puredanger: and is already now, but nt yet promised

12:06 puredanger: rhickey: thanks, very helpful (and I'll take that as a promise :) )

12:08 arkh: I thought I read somewhere that defstruct would not be used anymore, instead using defrecord or deftype (??) What should be used?

12:08 puredanger: cemerick: btw, I will reply to your question on the enclojure list re maven...still in my queue

12:08 cemerick: arkh: I can't think of any reason to use defstruct anymore.

12:08 jcromartie: and is defrecord useful for Clojure interop from Java?

12:08 cemerick: It should probably be marked as deprecated.

12:08 arkh: cemerick: why the change?

12:09 cemerick: arkh: because records are better in every way :-)

12:14 puredanger: cemerick: one nit I've seen with records is that you can't gradually construct them as in the record the fields are final/immutable and you must set during construction

12:15 cemerick: puredanger: you mean vs. structs?

12:15 jcromartie: you mean you can't say (assoc some-record :key val)

12:15 ?

12:15 cemerick: structs are persistent and immutable as well

12:16 oh

12:16 jcromartie: I think puredanger means that you can't provide fewer values than the number of defined slots to a record's ctor.

12:16 puredanger: cemerick: yeah, what jcromartie said

12:17 cemerick: which is true...but sort of inconsequential

12:17 puredanger: cemerick: kind of the old constructor injection vs setter injection argument

12:17 jcromartie: right

12:17 cemerick: wait, I'm confused now

12:17 puredanger: you can certainly assoc in a new value for a defined field

12:17 jcromartie: so someone tell me: why are records better than objects? :)

12:17 rhickey: puredanger: you will be able to do so with a factory that constructs the record from a map. The positional ctor is kind of a low-level thing

12:17 puredanger: cemerick: agreed, the vast benefits of having final immutable fields overweighs that for me

12:17 jcromartie: (aside from immutability)

12:18 puredanger: rhickey: ah, that makes sense - basically the builder pattern

12:18 rhickey: puredanger: the name of that factory fn is still being worked out, but it will be provided by defrecrod

12:18 * rhickey can't type record

12:20 puredanger: rhickey: cool. reminds me of a blog post I wrote about using Builder and Factory Method patterns to swap between constructor and setter dependency injection styles in Java http://tech.puredanger.com/2007/07/30/builder-factory/

12:22 riddochc: I've got a few places in my code where I'm using maps that I'd probably benefit from promoting them to records.

12:24 puredanger: rhickey: for the time being, we just hacked in a new print-method for records to print as (Foo. 1 2 3). because multimethods are the shit. we'll pull that crutch out later.

12:26 fogus: rhickey: Any plans for providing a way to describe invariants (i.e. pre- post-) for the factory fn?

12:28 rhickey: fogus: the factory function may be user-overridable, and then you can do whatever you please. But that may leave the positional ctor without protection

12:30 fogus: rihickey: I don't mind too much about that. If the ctor is viewed as low-level then I'm happy with all bets being off when using it.

12:30 rhickey: fogus: agreed

12:30 fogus: rhickey: ^^ (sorry)

12:31 puredanger: rhickey: what if you made the positional constructor private when a factory function is defined?

12:31 * rhickey has the wheels off in the num branch exploring changes to numeric semantics

12:32 fogus: I've gotten to the point in my contracts lib where I have started thinking about type/record invariants, so I'm more than happy to stop thinking about it until the factor fn is fleshed out :-)

12:32 rhickey: puredanger: that would make it hard to write such factories

12:33 puredanger: the idea is to move away from things that would, in Java, need to be methods. 'Protection' engenders that

12:33 better to think of the records as information and an open set of functions as the API

12:36 personally I think protection is always in the way. Why should we write software protecting ourselves from those that would build on top of implementation details? We should avoid such people

12:36 puredanger: rhickey: I will meditate on that as a koan

12:37 rhickey: in general, I agree. but I have 15 years of institutional Java baggage to work through :)

12:37 cemerick: puredanger: of course, a particularly sane java pattern is for data objects to only have a ctor and public final fields. Makes lots of things easier, if you can get away with it. :-)

12:38 rhickey: puredanger: well, it's a classic case of tradeoffs where people don't measure the cost. It *seems* like protecting things is a good idea, why not? The why not is, it creates incredible pressure to put things on the inside, a limited, closed space.

12:38 puredanger: cemerick: yes, I am a fan of that style when it makes sense

12:38 rhickey: agreed

12:39 cemerick: well, that's the default in clojure :-)

12:39 maybe except when one would want to muck with bits of clojure implemented in Java :-/

12:40 rhickey: anyone know of a way to get IntelliJ to show you all the cases of auto-boxing?

12:41 riddochc: I agree with your koan on protection, rhickey. It's one of the things that's always bothered me about traditional java.

12:43 rhickey: I think the application of OO to information is one of its biggest failings

12:47 quotemstr: rhickey: How so?

12:47 I'm just glad opposition to OO is no longer heretical.

12:51 rhickey: quotemstr: to the extent OO is about encapsulation, what's the point of encapsulated information (i.e. with custom access protocols)? You can get representation independence with common access protocols. To the extent it is about messaging/behavior, that too makes no sense for information. State?, also, no

12:58 jashmenn: how do I get a class object for something that is not a primitive. e.g. Integer/TYPE only for a custom object

12:59 Chousuke: ClassName

12:59 jashmenn: oh wait nvmd, i see my problem. Integer/TYPE returns int

12:59 thanks Chousuke

12:59 makes sense

13:09 pao: #erlang

13:34 anars: &window 1

13:34 oops.

13:41 vin: http://sprunge.us/BSYF I have this file, and I am trying to compile it, so I start clj in the directory where that file is and type (compile 'cmd-line-demo) and it tells me: java.io.IOException: No such file or directory (cmd_line_demo.clj:1)

13:42 the filename is cmd_line_demo.clj

13:42 jcromartie: does your clj program include the current directory in the CLASSPATH?

13:42 .

13:43 vin: no, I guess it does not, how do I do that?

13:46 jcromartie: well, what `clj` program are you using?

13:46 did you write it yourself?

13:46 (I use my own shell script)

13:46 I'm not sure what's out there now

13:47 vin: http://sprunge.us/jaGA this one

13:49 jcromartie: hmm, that includes "."

13:52 eevar_: hmm.. the lazy stuff was included in 1.0, right? -- clojure.org/lazy says: (Note: this section describes work in prerelease, available in the SVN trunk since rev 1287)

13:53 cemerick: This seems wrong:

13:53 ,(.append (StringBuilder.) (make-array Character/TYPE 0))

13:53 clojurebot: #<StringBuilder [C@d96f5b>

13:54 Licenser: ,(str (.append (StringBuilder.) (make-array Character/TYPE 0)))

13:54 clojurebot: "[C@170efea"

13:54 Licenser: hmm oi

13:55 cemerick: ,(.append (StringBuilder.) (make-array Character/TYPE 10) 0 1)

13:55 clojurebot: #<StringBuilder

13:55 Licenser: ,(str (.append (StringBuilder.) (make-array Character/TYPE 65)))

13:55 clojurebot: "[C@f6b220"

13:55 Licenser: ,(.append (StringBuilder.) (make-array Character/TYPE 65))

13:55 clojurebot: #<StringBuilder [C@d5acae>

13:55 cemerick: rhickey: seems like a dispatch issue? ^^

13:56 ,(.append (StringBuilder.) ^chars (make-array Character/TYPE 0))

13:56 clojurebot: #<StringBuilder >

13:57 cemerick: oh, it's getting routed through the Object overload :-/

13:57 The char[] overload is a perfect match though.

13:57 Licenser: (doc make-array)

13:57 clojurebot: "([type len] [type dim & more-dims]); Creates and returns an array of instances of the specified class of the specified dimension(s). Note that a class object is required. Class objects can be obtained by using their imported or fully-qualified name. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE."

13:57 Licenser: ah I see how it works

13:58 rhickey: whither char-array?

13:58 Licenser: wel the reason might be that the make array thing isn't initialized?

13:58 ,(make-array 0)

13:58 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$make-array

13:58 Licenser: ,(make-array Character/TYPE 0)

13:58 clojurebot: #<char[] [C@125997>

13:59 rhickey: (doc char-array)

13:59 clojurebot: "([size-or-seq] [size init-val-or-seq]); Creates an array of chars"

13:59 Licenser: ,(.append (StringBuilder.) #^chars (make-array Character/TYPE 65))

13:59 clojurebot: #<StringBuilder

13:59 Licenser: ,(.append (StringBuilder.) #^chars (make-array Character/TYPE 0))

13:59 clojurebot: #<StringBuilder >

13:59 Licenser: hmm this looks better doesn't it?

13:59 ,(.append (StringBuilder.) #^chars (make-array Character/TYPE 1))

13:59 clojurebot: #<StringBuilder

13:59 cemerick: yes, I demonstrated that earlier

14:00 Licenser: oh ojkay sorry :) I didn't read that

14:00 cemerick: why do you have to be faster then me at boing smart? :P

14:00 cemerick: rhickey: char-array or not, shouldn't (.append sb any-char-array) get dispatched to the char[] overload?

14:00 Licenser: ,(.length (.append (StringBuilder.) #^chars (make-array Character/TYPE 1)))

14:00 clojurebot: 1

14:01 Licenser: ,(.length (.append (StringBuilder.) #^chars (make-array Character/TYPE 42)))

14:01 clojurebot: 42

14:01 Licenser: okay this is greatish :D

14:01 but cemerick you are right, it should

14:02 $(.length (.append (StringBuilder.) (make-array Character/TYPE 10)))

14:02 sexpbot: => 10

14:02 Licenser: ,(clojure-version)

14:02 clojurebot: "1.2.0-master-SNAPSHOT"

14:02 Licenser: $(clojure-version)

14:02 sexpbot: => "1.2.0-master-SNAPSHOT"

14:03 Licenser: cemerick: it seems to work on sexpbot, perhaps it is a clojurebot thingy?

14:03 cemerick: Licenser: I get the same bad behaviour in my repl. Not sure what the bots versions are.

14:04 Licenser: the sexpbot uses the lates snapshot, I'm not sure about clojurebot exactly

14:04 cemerick: $(.append (StringBuilder.) (make-array Character/TYPE 0))

14:04 sexpbot: => #<StringBuilder >

14:04 cemerick: I'm not far from the latest -- lagging by a few days tops.

14:04 Licenser: cemerick: I'm not entirely sure

14:05 oh wait no it might be clj-sandbox who accidently fixes it

14:05 clj-sandbox uses it's own .

14:05 not the clujure one, meaning it might be 'more correct' about relfection then clojure itself o.O

14:06 anars: same behavior on clojure 1.1.0

14:07 Licenser: http://github.com/Licenser/clj-sandbox/blob/master/src/net/licenser/sandbox.clj#L28 is what I use instead of the original

14:07 *.

14:07 cemerick: anars: in that case, I either really don't understand how host dispatch is supposed to work, or this is a long-standing bug.

14:08 * cemerick actually uses a team of monkeys to write clojure programs, which are really good for ferreting out the tough bugs and regressions.

14:09 zakwilson: Wouldn't a team of ferrets do better at that?

14:09 cemerick: monkeys type faster

14:11 rhickey: cemerick: it is a long standing bug in any API that takes Object that when given one of its other arg types as an Object it doesn't call the same code

14:11 i.e. StringBuilder is broken

14:11 cemerick: hrm

14:11 but:

14:12 ,(.append (StringBuilder.) (.toCharArray "foo"))

14:12 clojurebot: #<StringBuilder foo>

14:12 cemerick: oh, string representation

14:12 * cemerick facepalms

14:12 LauJensen: Is there anything in contrib which does (shorten 6 "hey there!") => "hey..!" ?

14:13 cemerick: rhickey: I remain confused. Shouldn't the most specific overload be dispatched to? What's so special about having an Object overload?

14:14 rhickey: cemerick: this using reflection?

14:15 cemerick: rhickey: presumably, yes

14:15 rhickey: no, so, all compiler knows is you have an object, it matches, done

14:16 that's why this API is broken, you should never do something different for a reference type arg than you would for the same object passed as an Object

14:16 cemerick: 'course, it never actually matters in Java, so it probably never came up

14:17 or, doesn't matter in non-reflective java calls, I should say

14:17 rhickey: cemerick: it does matter in Java, if you have your stuff in a collection of Objects and pass to the API

14:18 it's a goofy broken API that does that

14:18 overloading gone awry

14:19 cemerick: But wouldn't the only alternative be to force a .toString call on every object that you would otherwise pass into append?

14:19 rhickey: cemerick: no, append Object should do the right thing

14:20 cemerick: oh, *if* there's a useful other overload available

14:20 rhickey: cemerick: exactly, same object through 2 different doors should get same result

14:22 doing something different based upon the static type of the object is just bad design, IMO

14:24 fragile at least

15:14 durka42: with leiningen, how do I add as a dependency a jar that is not found in any repositories (i.e., it came from sourceforge)?

15:14 lancepantz: durka42: i usually add it to clojars

15:15 durka42: lancepantz: add the external jar to clojars?

15:16 lancepantz: yeah, and then add it as a dep on your project

15:16 that's what i always do atleast

15:16 you can also set up a private repo

15:17 durka42: lancepantz: i'll try the clojars way

15:26 arkh: does anybody have a favorite "clj script"? Or is there anything sophisticated like ipython?

15:42 dakrone: arkh: here's my favorite: http://gist.github.com/438179 and the ~/.clojure.conf file I use: http://gist.github.com/438180

15:46 arkh: dakrone: thank you

15:46 dakrone: :)

15:56 serp_: I have a bunch of functions with side-effects. is it possible to, during a transaction, enqueue a bunch of function calls to these functions and have them run only after the transaction finished successfully?

15:56 chouser: serp_: you could send them to an agent

15:57 serp_: chouser: but won't the agent start processing my requests even though the transaction didn't finish?

15:57 chouser: nope. sends to agents are held until the transaction commits

15:57 serp_: aha nice. just was I was looking for :9

16:14 timcharper: I think the single most painful thing about clojure right now are the back traces.

16:15 lancepantz: agree 100%

16:19 timcharper: Is there any hope of things improving in clojure 1.2?

16:20 rfg: Is there a list anywhere of interfaces that can be implemented in a deftype?

16:20 dnolen: timcharper: doubtful, 1.2 is pretty close to being done it seems. what dev environment do you use?

16:21 rfg: ? I think deftype/defrecord can implement any Java interface unless I'm mistaken.

16:21 timcharper: I'm currently using Clojure 1.1

16:22 dnolen: timcharper: I mean dev environment - Eclipse, Netbeans, Emacs?

16:23 rfg: dnolen: Right yeah.

16:24 timcharper: Does anybody else run into this? If an error occurs within an anonymous function called by a lazy sequence, all stack trace beyond that point is completely lost?

16:25 Actually, it seems that it's just the anonymous function that does it.

16:25 I don't understand why the stack trace needs to be lost. It's my understanding that every element of code in clojure has metadata indicating which line it came from

16:25 rfg: dnolen: I guess I'm trying to ask for common clojure interfaces for ISeq, etc.

16:28 Does that make any sense?

16:31 Does one just look at clojure.lang source code?

16:31 chouser: timcharper: are you seeing only a single Cause instead of the whole chain?

16:34 so it definitely strikes me as awkward that protocols can't dispatch on meta :type or something.

16:35 I define a protocol because it makes sense conceptually. Perhaps extend it to a class or two. Then realize it would fit nicely with an informal object type I've been using that's just a clojure map.

16:36 ...and I'm stuck.

16:36 I guess my best option is to switch from a protocol to multimethods and adjust all my existing implementations?

16:36 raek: exceptions that escapes from code that run "inside" a lazy sequence are caught by the forcing mechanism and thrown as the cause of a RuntimeError

16:37 I think this has to do with that exceptions thrown from a lazy sequence may end up anywhere

16:37 depending on when the lazy sequence is realized

16:37 AWizzArd: chouser: that sounds at least like a workable strategy

16:37 chouser: but it's really annoying.

16:38 it suggests to me that perhaps I shouldn't be using protocols at all until I'm ready to switch to higher-performance code.

16:39 But the syntax for multimethods is quite different than protocol implementations, so requires significant refactoring to accomplish. feels un-clojurey

16:42 raek: timcharper: the original exception should be wrapped in a RuntimeException

16:42 timcharper: http://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java#L45

16:43 timcharper: raek, chouser: I'll come up with sample code that shows the issue... one moment

16:43 thanks :)

16:43 raek: actually, that explains it. If the original exception is wrapped in another exception, that would explain why I can't see the backtrace for with the default backtrace formatter

16:44 Or does it?

16:45 raek: some formatters (emacs?) also shows "caused by:" and continues with the cause

16:46 my experience is that error reporting with exceptions and lazy sequences don't play well together

16:46 chouser: timcharper: no it doesn't -- you should see all caused-by's, or you need to fix your environment

16:46 timcharper: chouser: okay, perhaps something is broken then. (Good news)

16:46 raek: one could throw an Error instead of an Exception, but that is kinda hackish

16:47 AWizzArd: chouser: yes, some intermediate macro that expands into multimethods or protocolls could be helpful

16:48 raek: or, sometimes one can restructure the code to work like middleware in compojure does

16:48 (which resembles continuation passing style a lot, IMO)

16:53 serp_: is there a neat way of "decorating" a function in clojure? let's say I have a function f and want to replace it with a function that does something to the arguemnts before passing them on to f

16:54 dnolen: serp_: sounds like comp to me

16:54 danlarkin: rober hooke!

16:55 http://github.com/technomancy/robert-hooke

16:58 raek: ((comp f g) val) does (f (g val))

16:59 a decorating function can choose not to call g

17:00 chouser: serp_: every high-order function is a sort of decorator

17:00 raek: example (ring/compojure middleware): (defn my-decorator [handler] (fn [request] (if (...) (handler request) ...)))

17:01 timcharper: chouser, raek: now that you have pointed it out (the "caused by" lines in the stack trace), I understand what's going on, and I'm seeing that the stack trace is in fact pointing me where I need to look. Thank you!

17:01 serp_: I'd like to do a more static decoration

17:03 raek: memoize in clojure.core is used this way: (def my-fn (memoize (fn [...] ...)))

17:03 or maybe (defn my-fn [...] ...) (def my-fn (memoize my-fn)

17:04 there's a defn-memo macro in clojure.contrib.def to make this shorter

17:08 serp_: it's not memoization I want to do though

17:11 raek: can you show a simple example of what you want to be able to do?

17:13 serp_: sure

17:15 http://aee22f28384e4376.paste.se/

17:16 so I would like to wrap a function inside another function with the same name

17:18 raek: is there any special reason to let them have the same name?

17:18 serp_: the real use for this is to make the set-pos function in a game not only change the position of a character but also send the new position over the network

17:19 raek: redefining functions -- in other cases than fixing broken code -- should be avoided

17:19 chouser: hm... the position of the character is held in a reference object?

17:19 serp_: chouser: yup

17:19 chouser: serp_: do you know about watchers?

17:19 serp_: nope

17:19 chouser: (doc add-watch)

17:19 clojurebot: "([reference key fn]); Alpha - subject to change. Adds a watch function to an agent/atom/var/ref reference. The watch fn must be a fn of 4 args: a key, the reference, its old-state, its new-state. Whenever the reference's state might have been changed, any registered watches will have their functions called. The watch fn will be called synchronously, on the agent's thread if an agent, before any pending sends if agent or r

17:20 serp_: awesome

17:20 sounds just like what I'm after

17:21 anars: is add-watch being stabilized with clojure 1.2.0?

17:21 sholden: whats the timeframe on 1.2?

17:21 chouser: anars: hasn't changed since before 1.0, iirc.

17:21 anars: aye

17:21 chouser: seems pretty stable. :-)

17:22 AWizzArd: true

17:22 ,(doc subseq)

17:22 clojurebot: "([sc test key] [sc start-test start-key end-test end-key]); sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true"

17:23 AWizzArd: Someone mentioned a few days ago that subseq can also return nil, while this docstring makes me think that it will always return a seq.

17:23 Those doc strings could benefit from an update

17:30 raek: can somebody bring me up to date about how #^ and ^ has changed?

17:30 ^ is the new #^ ?

17:30 chouser: yes

17:30 ^x used to mean (meta x) but doesn't anymore.

17:30 raek: and old ^ must be written in the full (meta ...) form nowadays?

17:30 chouser: yes

17:31 raek: so, what will "new #^" be?

17:31 chouser: haven't heard of anything yet. I don't think it's even officially deprecated, which would probably happen for a release before it's used for something else.

18:32 zakwilson: I wonder how much risk there is in exposing Swank to the public internet.

18:39 dakrone: zakwilson: would they be able to connect and via java-interop run system commands on your system?

18:40 zakwilson: dakrone: Yes. There's no doubt that it's a risk in theory. It's more a question of liklihood.

18:49 SSH tunneling should be the Right Thing, but it doesn't seem to be working.

18:52 raek: I often use ssh tunneling with swank...

18:55 zakwilson: It was working on my LAN, but not over the public internet

18:56 ssh -L 4005:localhost:4005 user@public-IP # opens the port but I get "connection refused" when I try to use slime-connect

19:01 raek: and you're connecting to localhost:4005 with slime?

19:03 zakwilson: raek: yes

19:04 On the remote box, I see "channel 3: open failed: connect failed: Connection refused"

19:05 raek: strange

19:07 zakwilson: Possibly oddness related to the fact that remote box is a Mac.

19:12 Chousuke: the firewall thingy in OS X might be blocking you?

19:13 I got a prompt asking is java is allowed to listen for connections when I first used swank :P

19:14 zakwilson: I can connect to Swank directly. I just can't connect over the SSH tunnel

19:21 arohner: zakwilson: can you connect to swank locally, on the remote box?

19:24 zakwilson: arohner: I think you may have solved it for me. I can connect remotely, but NOT locally. I previously had the opposite problem and had to specify the IP to bind to.

19:25 * zakwilson thinks the ssh tunnel is probably a bit more secure than running Swank on a nonstandard port.

20:31 anonymouse89: clojure equivalent of common lisp logbitp, anyone?

22:18 herdrick: question: on the topic of dealing with maps as if they were sets

22:18 in the sense that merge-with is sort of like union of sets

22:19 i want to combine two maps like merge-with does, except I want some special handling for the case when a key is in only of of the maps

22:19 so i wrote this:

22:19 http://gist.github.com/438610

22:19 any thoughts?

22:19 i swear there should be a better way

22:20 in fact something more general yet than this would be a good thing for the core or at least contrib

Logging service provided by n01se.net