#clojure log - Jan 12 2009

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

0:14 durka: does this function exist?

0:15 (defn eval-in-ns [ns code] (binding [*ns* (the-ns ns)] (eval code)))

0:15 (eval-in-ns 'kitchen '(make-coffee))

0:16 hiredman: clojurebot: latest?

0:16 clojurebot: latest is 1207

0:16 hiredman: svn rev 1207

0:16 clojurebot: svn rev 1207; intial import of streams stuff, Java side

0:16 hiredman: durka: I don't think so

0:20 Chouser: 'eval' is generally frowned on. It's there because it needs to be for repls and the system itself to work, but not much effort is made to make it convenient.

0:54 dcnstrct: hrm... I want parenscript for clojure.

0:55 dhaya: dcnstrct: did you look at clojurescript in contrib?

0:55 dcnstrct: what ?! you're kidding me

0:55 no I'll check it out

0:55 burkelibbey: http://github.com/kevinoneill/clojure-contrib/tree/master/clojurescript

0:56 dhaya: I don't think it is complete yet though.

0:56 burkelibbey: Nope

0:57 Chouser: dcnstrct: what do you want out of it?

0:58 dcnstrct: I want to use it together with a web serverl ike Jetty and JCouchDB for my persistance layer

0:58 and kind of roll my own all lisp web framework

0:58 burkelibbey: Obvious question is "have you looked at Compojure?" ;)

0:59 Chouser: and you want to be able to write ajaxy event handlers in clojure and have them work in the browser?

0:59 dcnstrct: actually no I hated the name so bad ;)

0:59 I'll go check it out

0:59 burkelibbey: haha, that was my reason for not looking at Webjure.

0:59 Chouser: or what role would clojurescript play?

1:00 dcnstrct: Chouser, well mainly I want to write a whole web app in lisp, so that means I'll want a DSL for generating XHTML and one for JS

1:00 and hopefully the two would play nicely with eachother

1:01 Chouser: there are probably dozen libs that convert some style of clojure s-expr or other to x/html.

1:01 there are even one or two clojure-to-json libs around

1:02 danlarkin: there sure are!

1:02 dcnstrct: that gets me pretty damn close then =]

1:02 Chouser: but if you actually want to produce javascript *code* from clojure-like sources, clojurescript can do it.

1:03 burkelibbey: With regard to just the html DSL, compojure seems to have this: http://github.com/weavejester/compojure/tree/master/src/compojure/html.clj

1:03 Chouser: I was rather excited about it for a while, but I'm starting to wonder just exactly how narrow the use cases are.

1:05 dcnstrct: Chouser, What I really want to do is I want to create a clojure DSL around a system called Open Laszlo. Open laszlo sources are just xhtml and JS, but they get compiled down to flash bytecode

1:05 Chouser: heh. clojure -> js -> flash?

1:05 dcnstrct: so that way I can write flash apps without having to endure ActionScript and or lots of pointy brackets

1:06 clojure -> js/xml -> laszlo compiler -> flash=*OR*dhtml

1:06 Chouser: fascinating. I've heard of laszlo, but I wasn't aware it included js->flash

1:06 dcnstrct: yeah you program declaratively?sp? with an XML/JS based DSL

1:07 and then the program can be compiled into either a JS app

1:07 or a flash app

1:07 burkelibbey: That sounds really cool -- I may have to check that out.

1:07 dcnstrct: and it's all written in java too, so it may be clojure friendly

1:08 =] thnx for the hep people.. checking out compujure and clojurescript. ttyl

2:28 joma: hmm coming back to python after using clojure just feels wrong

2:28 its like clojure and haskell are just above everything else

2:32 banisterfiend: joma: yeah the local gay community has that as their slogan, are you sure you're not wearing a pink t-shirt and sitting on a dildo

2:37 Lau_of_DK: Morning all

2:38 Chousuke: morning

2:54 Chouser: clojure.main isn't pleasing me. I suppose I'll have to write up a whole thing as to why, if I want it to change.

2:55 I feel bad I didn't test it and speak up earlier. :-/

2:55 Lau_of_DK: Clojure.main ?

2:56 Chouser: ,(keys (ns-publics 'clojure.main))

2:56 clojurebot: java.lang.Exception: No namespace: clojure.main found

2:56 Chouser: hmph.

2:57 it's meant to replace clojure.lang.Script and clojure.lang.Repl, I believe.

2:57 I shouldn't be trying to talk -- it's too lat emand my brain's functioning quite as well as I think it is.

2:57 I think I just replied to a google group post. I wonder if it made any sense.

2:57 * Chouser goes to bed.

3:54 danlei: does anybody know, what the new equivalent of slime-redirect-inferior-output is?

5:18 AWizzArd: clojurebot: max people

5:18 clojurebot: max people is 127

7:56 grosours: hi everybody

7:56 Lau_of_DK: Hey hey

8:13 vsthesquares: http://adiumx.com/blog/2009/01/msn-rejecting-adium-132-connections/

9:42 AWizzArd: I have a 2 line clojure file: line1: (ns 'my.file (:gen-class)) and line2: (defn foo [bt text] (.setText bt text)). I (compile) this to .class files and would like to call foo from Java.

9:44 How can I load the contents of the .class files? And when this happened, how can I call foo?

9:46 cooldude127: AWizzArd: you can't call it from java

9:46 any functions defined on your class need to have a "0

9:46 "-" prefix

9:46 sorry typo

9:46 http://clojure.org/compilation

9:47 AWizzArd: oki

9:48 cooldude127: i'm not sure if or how you can define static methods on a class from clojure

9:51 Chouser: you can can use clojure methods to call clojure fns from java

9:52 I suppose you'd start with a call to 'require' to load the namespace, and then you could fetch the Var for foo and invoke it

9:53 AWizzArd: What is the function to call Clojure functions with Clojure from Java?

9:53 Chouser: Instances of Var are invokable.

9:55 dhaya: AWizzArd: http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Invoking_Clojure_from_Java

9:56 Chouser: take a look at src/jvm/clojure/main.java

9:57 AWizzArd: good, thanks

10:52 danlarkin: java is like python, in that if I (catch Exception...) any exceptions that inherit from Exception will be caught, right?

10:52 Chouser: yes

10:53 danlarkin: cool

10:53 Chouser: which is almost, but not quite, all of them.

10:53 danlarkin: of course

10:53 why wouldn't it be all

10:53 that would be too convenient

10:54 Chouser: if you really want all of them, use Throwable. But that's generally discouraged

10:59 danlarkin: I was planning on using mmcgrana's clj-backtrace to display exceptions through a web browser, to do that I'm assuming I'll have to catch everything and then deal with printing it to the browser

10:59 mmcgrana: danlarking: Throwables are either Errors or Exceptions, Exceptions are meant to be recoverable, Errors are usually meant to be fatal.

10:59 danlarkin: very exciting release this evening on that front!

11:00 danlarkin: Ooo la la

11:02 Okay, so maybe it's better just to catch Exceptions then

11:03 mmcgrana: but yeah the basic idea would be to add a try/catch around the app, and when Exceptions bubbled out print the backtrace to your response body, using either (pst-str e) or a lower-level api to customize the output, as you'll see in the release.

11:05 danlarking: yes Error = game over. subclasses are e.g. ThreadDeatha and VirtualMachineError

11:05 ack keeping mispelling your name

11:05 * I keep

11:09 danlarkin: haha everyone does

11:09 it's the "ing" muscle memory

11:09 mmcgrana: o yeah good point

11:10 Chousuke: it sometimes appears when talking about python too

11:17 mmcgrana: danlarkin: btw have you seen the new colorizing in clj-backtrace? http://img.skitch.com/20090112-qu36c7p478nbkt1e2knt2hch1g.jpg

11:18 danlarkin: I have, it's super great, I hope I can make it work over the web

11:21 I'm sure I can, I just haven't tried yet

11:38 Chouser: hm, clojurescript compiler in an applet works.

11:38 rhickey: cool

11:39 Chouser: this should make the browser-based repl more sane, since it won't have to ship code off to a server to be translated.

11:40 rhickey: yes, very neat

11:41 so applets work ok in general?

11:41 Chouser: I've not gotten one to work on Mac yet, but that's hard for me to test.

11:41 rhickey: I'd love to figure that out, since only Macs here

11:42 Chouser: :-)

11:43 there is a Mac in the house, but I don't get much time on it usually.

11:44 So I may be able to make an attempt to track it down at some point.

11:45 rhickey: my cursory glance at the error makes me feel like it is just that when compiled something is protected/public, and thus wrapped by gen-class, that at runtime on the Mac JVM is less accessible

11:46 I wonder if an :only option for gen-class would be useful

11:46 Chouser: but you got a trivial applet to load and init ok, right?

11:47 oh, you only tried appletviewer, didn't you?

11:47 rhickey: Chouser: appletviewer

11:48 Chouser: I think durka was reporting my applets were working fine in the appletviewer even on Mac.

11:49 rhickey: I know (way back in the '90s) some applets were confused when read from the file system vs over the net, in browser

11:49 but not the case here reading yours over the net

11:53 Chouser: at the moment I have the applet returning a PersistentArrayMap, but of course this is a different beast than clojurescript's PersistentArrayMap. This is weird to think about.

11:54 rhickey: heh, yeah, now you have Java and js on same side of the fence

11:55 Chouser: I suppose the functions in rt.js (like 'first', 'seq', etc.) could be made to interoperate with the Java objects.

11:59 rhickey: Chouser: once you have full Clojure engine on that side, you could implement simple interpreter for Clojure on Clojure (just to make things more confusing)

11:59 Chouser: yes, I'd thought of writing a clojure interpreter in clojure.

11:59 Chousuke: so wait what.

12:00 Chouser: that would at the very least be more fun than writing (and maintaining!) clojure.lang.RT in javascript.

12:00 Chousuke: you can't have a applet the provides a full clojure repl currently, because to do that you need to load dynamic bytecode, which applets (and android devices) won't allow.

12:01 Chousuke: hm, right.

12:01 so you'd need an interpreter.

12:01 Chouser: but if you were to write an interpreter that examined clojure s-exprs and called the appropriate Java functions, then you could have a repl.

12:01 danlarkin: this is rife with opportunity for a "yo dawg I wrote clojure in clojure so you can eval while you eval"

12:02 Chouser: but since clojure can now be compiled to classes, you could write this interpreter in clojure

12:02 Chousuke: such an interpreter would be useful for the sandbox too I think.

12:03 Chouser: or go the route I started pursuing last night, which is to have the applet produce javascript and eval that in the browser.

12:03 rhickey: Chouser: a lot of simple expression support for an interpreter is done, given Compiler.Expression.eval()

12:03 Chouser: rhickey: is that used for anything currently? I've never quite understood why it's there.

12:04 rhickey: Chouser: some things at the repl still run through it - used to be a lot more, but now fast enough to rwap in fns/conmpile/run in order to ensure same semantics

12:04 StartsWithK: Chouser: you mean you can't have dyamic bytcode in applet? like, clojure can't compile .clj on the fly inside the applet?

12:04 Chouser: huh. ok.

12:04 StartsWithK: right.

12:05 StartsWithK: Hmm

12:05 rhickey: but essentially, almost all of Clojure except fns can be eval'ed like that

12:05 StartsWithK: i had opengl gears demo in clojure running in applet like 4-5 months ago

12:06 you can denerate dynamic bytecode inside applet

12:06 Chouser: StartsWithK: ah, yes, I should be more specific. I'm talking about applets without lowered security barriers, that is, unsigned applets.

12:06 StartsWithK: gnerate*

12:22 Chousuke: what is the main problem? That you have to give AllPermissions to your applet? Could that be solved by using RuntimePermission and restricting your applet so it can only generate bytcode in safe packages?

12:23 Chousuke: I don't think it needs AllPermissions, but the problem is that it needs *any* permission

12:24 it would be useful to just be able to run unsigned clojure code in an applet.

12:25 StartsWithK: sorry, Chouser*

12:34 ole3: is there a mapping between namespaces?

12:35 I have a ns foo-bar and this seems to get mapped to foo_bar

12:35 when i load the package

12:36 technomancy: I think it's just the dash-underscore translation.

12:36 that one allows you to work around a limitation of the JVM

12:37 ole3: hm, so i have to name my directories with underscores

12:37 to load it i mean?

12:37 technomancy: afaik the only rule is any dashes in namespace names need to be underscores on disk, yeah

12:38 but that applies to files and directories

12:38 ole3: so it is better not to use dashes in namespaces?

12:38 technomancy: if you have two-word namespaces, you should separate them with dashes.

12:39 but if you can use one-word for each part of the namespace, that's fine too. =)

12:39 ole3: thank you

13:18 danlarkin: OT but really good post, http://groups.google.com/group/microsoft.public.sqlserver.programming/msg/6d61dbf80d6f0fb6

13:19 Chouser: I think rather than renaming rest to tail and adding a new function rest, it might be better to introduce a new fn to encapsulate the idiom: 'has-rest' or something.

13:19 Lau_of_DK: Good evening gents

13:20 danlarkin: Afternoon Lau

13:20 Chouser: "rest?"

13:21 Chouser: danlarkin: sure, something like that. I think it would be unnecessarily tricky to keep 'tail' and 'rest' straight.

13:21 Lau_of_DK: Chouser: Was any decicision made on nil punning yesterday?

13:22 Chouser: Lau_of_DK: not that I know of.

13:22 Lau_of_DK: Ok

13:22 danlarkin: wouldn't it be most common to use rest, though? I mean to say that 'tail' would have limited usage in user code, right?

13:24 gnuvince_: ,(time (dotimes [_ 10000] (last (sort (range 1000)))))

13:24 clojurebot: "Elapsed time: 5648.104 msecs"

13:24 gnuvince_: ,(time (dotimes [_ 10000] (reduce max (range 1000))))

13:24 clojurebot: "Elapsed time: 322.303 msecs"

13:24 cooldude127: well then

13:24 that's good to know

13:25 Chouser: reduce max is linear vs nlogn for sort. But the real difference probably comes from sort putting the whole seq into an array and then calling Java's sort.

13:25 gnuvince_: There's a WTF on reddit about "how to find the largest element without looping" and some people are saying things like "well if the sort routine is written in C..."

13:26 danlarkin: ,(time (dotimes [_ 10000] (first (sort > (range 1000)))))

13:26 clojurebot: "Elapsed time: 8490.771 msecs"

13:26 cooldude127: wow a big pile of suck

13:27 danlarkin: max it is

13:27 cooldude127: lol

13:28 danlarkin: gnuvince_: yeah I saw that thread... ridiculous

13:28 Chouser: ,(time (dotimes [_ 10000] (apply max (range 1000))))

13:28 clojurebot: "Elapsed time: 799.461 msecs"

13:28 gnuvince_: danlarkin: yes.

13:28 Chouser: ,(time (dotimes [_ 10000] (apply max (range 1000))))

13:28 clojurebot: "Elapsed time: 277.883 msecs"

13:28 cooldude127: wtf?

13:28 Chouser: ,(time (dotimes [_ 10000] (apply max (range 1000))))

13:28 clojurebot: "Elapsed time: 297.532 msecs"

13:29 Chousuke: must've been some glitch :)

13:29 danlarkin: nah, second run is always way way faster

13:30 I'm thinking it's some jvm optimizing going on profiling the first run and using it on subsequent runs? but really I have no idea

13:30 Chouser: much of the time 'apply foo' is essentially the same as 'reduce foo', but if one of them is going to be faster, it'll be 'apply foo'

13:30 Chousuke: especially true for str I guess

13:31 Chouser: Chousuke: right, that's the main example. but the point is that foo is control of the loop when you 'apply foo', so it can do the best/smartest thing

13:31 Chousuke: ,(time (do (reduce str (range 1000)) nil))

13:31 clojurebot: "Elapsed time: 12.906 msecs"

13:31 Chouser: with 'reduce foo' you're controlling the loop. 'foo' only sees 2 args at a time, and so can't do anything clever.

13:31 Chousuke: hmm, quick?

13:32 or maybe it noticed the result is nil and skipped the reduce :)

13:32 danlarkin: but try the apply :)

13:33 ,(time (do (apply str (range 1000)) nil))

13:33 clojurebot: "Elapsed time: 2.027 msecs"

13:33 Chouser: I told you, Clojure's alrady too fast.

13:33 Chousuke: ah right, maybe I should've added a dotimes to that :P

13:36 rhickey__: note that while it is true (apply foo x) let's foo decide the best course, (reduce foo x) let's x decide, if it has optimized reduce vs. seq navigation

13:36 lets

13:36 aargh

13:36 irc is destroying my English

13:36 danlarkin: clojure is destroying my python, serves you right!

13:37 Lau_of_DK: hmm... Clojure destroys Python... i like :)

13:37 kotarak: hehe :)

13:38 danlarkin: you guys and your python hating... psh

13:42 durka: rhickey_: what do you mean by optimized reduce vs. seq navigation?

13:42 do you mean if it is lazy?

13:43 * technomancy resists a snarky comment about how one line ought to be enough for anyone's lambda

13:44 rhickey__: durka: apply requires x be supplied to foo as a seq, reduce may hand foo to x for more efficient internal iteration

13:45 Chouser: ,(let [x (map identity (range 1000000))] (time (reduce + x)))

13:45 clojurebot: 499999500000

13:46 "Elapsed time: 1671.362 msecs"

13:46 Chouser: ,(let [x (range 1000000)] (time (reduce + x)))

13:46 clojurebot: 499999500000

13:46 "Elapsed time: 318.357 msecs"

13:47 rhickey__: Chouser: range may be a bad candidate as it optimizes both seq and reduce

13:47 Chouser: ,(let [x (vec (range 1000000))] (time (reduce + x)))

13:47 clojurebot: 499999500000

13:47 "Elapsed time: 238.569 msecs"

13:48 rhickey__: as a general rule I would say prefer reduce, except for str, as 1 str of n things is more efficient than n-1 strs of 2 things

13:48 Chouser: but if you use 'apply +', + will turn around and use reduce so you're still covered.

13:50 rhickey__: Chouser: still, prefer reduce, it will engender good habits and ways of thinking about things, apply is just for when you have the args for a single call in a seq already

13:52 Chouser: yessir

13:55 rhickey__: Sorry, didn't mean to be pedantic, just working on lfe/streams stuff and wondering if people really get reduce, since they'll need to

13:59 Chouser: I guess I should have said "ok" if I didn't want to sound injured. No need to apologize.

13:59 is reduce any harder to get than map?

14:00 rhickey__: I see lots of loop/recur where reduce would do

14:00 Chouser: ah, I see.

14:01 burkelibbey: People usually seem to have a little more trouble "getting" reduce.

14:02 rhickey__: for all those following yesterday's stream conversation, unification is definitely out. Just too much of a mismatch to have map be pure on seqs and mutating on streams

14:02 burkelibbey: So that means... nil punning stays, right?

14:02 Chouser: I wonder if 'reduce' could be rolled into 'for' somehow. People unfamiliar with functional programming seem to be more comfortable with 'for' at least at first.

14:03 (for [i (range 10) :reduce +] ?)

14:04 rhickey__: burkelibbey: nil punning safe for now, but as I said yesterday, fully lazy seqs are independent of streams, but unification would have allowed both

14:04 Chouser: (for [i (range 10) :reduce (+ i old-i?)] ?)

14:04 * Chouser will stop thinking out loud

14:05 rhickey__: :)

14:06 technomancy: was a decision reached on whether streams would be in 1.0 or not?

14:07 rhickey__: technomancy: I need to figure out if they require any breaking changes

14:10 technomancy: gotcha. just curious; I don't feel strongly either way.

14:10 Chouser: (for [i (range 10)] (+ i (previous i 0))) is so much easier to understand than (reductions + 0 (range 10)) :-P

14:13 rhickey__: Chouser: http://www.lispworks.com/documentation/HyperSpec/Body/06_ac.htm

14:15 http://www.lispworks.com/documentation/HyperSpec/Body/m_loop.htm

14:15 when you're ready to go really crazy with for

14:15 Lau_of_DK: I miss that loop :)

14:15 rhickey__: Lau_of_DK: not coming any time soon, loop is probably more complex than all of Clojure!

14:16 * Chouser sees where the path leads, and gets off while he still can.

14:16 Chouser: no thank you.

14:16 Lau_of_DK: hehe, really? thats surprising... I also remember using it while relying heavily on sideeffects

14:16 * technomancy is glad to hear that about CL's loop

14:17 technomancy: it's a good example of how you can do pretty much anything in Lisp syntax, but it's also a good example of why restraint in such an endeavor is important.

14:17 danlarkin: isn't there a project on github implementing LOOP in clojure? I might be wrong though, since I can't find it..

14:17 Lau_of_DK: rhickey__: I think you made a really good point about nil punning yesterday, are you looking to implement the proposed changes anytime soon ?

14:18 danlarkin: oh, nevermind, I'm thinking of FORMAT :)

14:18 Chouser: Lau_of_DK: 14:02 < rhickey__> for all those following yesterday's stream conversation, unification is definitely out. Just too much of a mismatch to have map be pure on seqs and mutating on streams

14:18 rhickey__: Lau_of_DK: there are no proposed changes yet, just wanted to see how people felt about it

14:18 Lau_of_DK: danlarkin: If you ran loop in something like SBCL, and stored all the results and calculations in an SQL table, then technically ClojureQL could be the project your looking for :)

14:18 rhickey__: ok... just sounded interesting

14:18 Chouser: thanks

14:19 joma: deos clojure have arrays or I use ajava arrays then? if i wanted to write a matrix-lib in clojure(just for fun I kno there a re good java ones), what would I use? vectors of vectors? vectors dont have O(1) access right? would I use dicts?

14:19 Chouser: Lau_of_DK: but there's a branch in svn for the streams stuff, if you want to play with it.

14:19 Lau_of_DK: cool

14:19 gnuvince_: joma: vectors have O(log32 n) random access

14:19 Which is pretty good

14:20 ,(/ (Math/log 1e10) (Math/log 32))

14:20 clojurebot: 6.643856189774725

14:20 Chousuke: maybe not acceptable for a matrix lib though

14:20 Chouser: how big would your matrix be!?

14:21 vectors are more "fun" in clojure than java arrays are.

14:22 rhickey__: Chouser: streams branch not ready for use yet

14:22 Chouser: ok

14:22 rhickey__: only about 1/3 is up

14:22 some Java stuff, no clj stuff

14:23 Chousuke: Chouser: sometimes you have really huge matrices :)

14:24 but I'm sure there are plenty of high-performance java matrix packages

14:26 rhickey__: http://piotr.wendykier.googlepages.com/parallelcolt

14:26 http://acs.lbl.gov/~hoschek/colt/

14:27 Lau_of_DK: rhickey__: Since your so informed about anything relating to software developement, I need to ask: Do you have a favorite bug tracker? :)

14:28 * technomancy is a big fan of projects whose bugs are too short-lived to merit a tracker.

14:28 technomancy: though of course that is hard to maintain. =)

14:28 Lau_of_DK: Its a little hard, yes :)

14:28 rhickey__: technomancy: I agree, and it was with trepidation I introduced: http://code.google.com/p/clojure/issues/list

14:29 Lau_of_DK: Especially when a bug can be anything from "Your software ate my cat" to "This line needs to be moved up 1 pixel"

14:29 technomancy: man, if clojure could eat cats that would be awesome.

14:29 Lau_of_DK: haha

14:29 My friend, I think you missed the point

14:30 Chouser: I think I've been proved wrong about the issues page being overrun, though.

14:30 which is good.

14:30 technomancy: I do love how short the issue list is.

14:31 seems like a good balance of bugs and enhancements

14:31 "Clojure is the least-buggy lisp implementation ever! Only sixteen bugs."

14:32 actually... none of the high-priority defects are even bugs.

14:33 kotarak: Some are also just documentation issues.

14:33 Which rules me out, I guess.

14:33 Chouser: and some are fixed, with patches waiting patiently to be applied. :-)

14:34 Lau_of_DK: Can we consider it a bug that ClojureQL is not included in Core yet, or do I need to post that somewhere else?

14:35 Chouser: heh

14:38 Lau_of_DK: ehh.. I made a funny? Not intentional I assure you :)

14:46 Chousuke: Looking at the stream code makes me wish java had macros. and I'm not even writing that code :D

14:50 joma: thats interesting. for real only 16bugs? how many does a language normally have? take python for example, or sbcl or Java or C++?

14:52 technomancy: joma: that's not really a good question to ask... for instance, many of Java's bugs will be inherited by Clojure, and C++ can't have any bugs since it's not an implementation, just a language standard.

14:52 actually, I take that back, C++ has tons of bugs even without being software.

14:52 arguably its entire existence

14:52 danlarkin: and python's been around for 18+ years, and clojure only ~3

14:53 two of which were unreleased

14:53 Chouser: also, that's a list of discovered but unfixed bugs. It says nothing about how many there were that have been fixed, and certainly not how many undiscovered bugs there may be.

15:08 joma: for(r=0; r<rows; r++) { for(c=0; c<columns; c++) {mtrx[r][c] = new_matrix[r][c];}} , why is that not working?

15:08 sorry wrong channel

16:03 Lau_of_DK: How does if-let work ?

16:04 drewr: Lau_of_DK: (if-let [foo true] foo :else) => true

16:04 (if-let [bar false] foo bar) => false

16:05 Lau_of_DK: (if-let [x (= 2 2)] x 5)

16:05 so x will be true and the rest is like a normal if then..

16:06 drewr: It binds the symbol if the value is true(-ish).

16:06 kotarak: Lau_of_DK: it's more interesting for things like (if-let [rst (rest of-a-seq)] (map stuff rst) ["The seq did not have a rest"])

16:06 drewr: It's the same as (if :foo (let [x :foo] ... ))

16:07 Er, (if :foo (let [x :foo] ... ) ...)

16:07 The other one was more like when-let.

16:08 Lau_of_DK: ok, thanks guys

16:23 Chouser: ha! clojurescript destructuring works on java clojure vectors.

16:34 danlarkin: Chouser: sweeeet

16:37 Chouser: it's goofy, but it was working already. vector destructuring calls clojure.nth

16:38 clojurescript's nth looks to see if the object has an nth method. The Java vector object does. So it gets called, pulls the value from the java object, and returns it through the javascript.

16:38 destructuring that assigns that to a local javascript variable, and you're off and running.

16:50 no new macros in a browser repl, though.

17:04 herkel: maybe im stupid but ic ant figure out the damn classpath, i have it working in clojure but in java i dnt get it. C:/javaprogs/Matrix/ , in there I have Matrix.java and MatrixTest.java. what should MatrixTest inherit and what package name should Matrix.java be in? wht should I pass as classpath when I compile?

17:05 kotarak: If C:/javaprogs is in your classpath, I would suspect Matrix to be in the package matrix.

17:05 package matrix;

17:05 public class Matrix ......

17:06 It's similar to Clojure. The package is the path to the file. The class (or in clojure: the last part of the namespace) is the file.

17:07 package foo.bar; class Baz ... <=> foo/bar/Baz.java

17:09 Raynes: I wish I could find an open source pastebin that supported clojure =\

17:11 Oh.

17:11 Found one.

17:11 :D

17:20 kotarak: Raynes: would you share your success?

17:23 Raynes: kotarak: Lodgeit is open source.

17:23 It also supports Haskell, just what I needed.

17:23 http://dev.pocoo.org/projects/lodgeit/

17:24 paste.pocoo.org

17:24 kotarak: Indeed. Clojure support available...

17:25 Raynes: I knew about Lodgeit, but I didn't know it was open source.

17:26 Chousuke: that's pretty nice.

17:26 Raynes: Agreed.

17:26 I'm going to slap it on my site :>

17:27 Chousuke: the rest of the utils look nice too

17:28 kotarak: And there is a Vim plugin for pasting...

17:28 danlarkin: I use werkzeug with django, it's very helpful

17:30 Raynes: Dirty vimmers.

17:30 craigmarshall9: :-D

17:38 durka: is (in-ns (ns-name ns)) the same as (set! *ns* ns) ?

17:39 and (binding [*ns* ns] ...)?

17:41 Fib: Are "symbols" in Clojure/LISP just another name for "identifier", or is there a difference? I have a feeling there is but I've not been able to pin it down from what little I know of LISPs.

17:41 durka: the documentation of in-ns seems to suggest that it would be, and i can't find an implementation, except one in java that seems to just call (set! *ns*)

17:42 Fib: there is a difference, but i think there is also a difference between a clojure symbol and a lisp symbol

17:42 but i am fuzzy on all three definitions as well

17:43 Chouser: Fib: My common lisp knowledge is weak, but I think there a "symbol" may have storage, so it's more like a variable.

17:43 technomancy: Fib: they're used *mostly* for identifiers, yes

17:44 symbols are usually bound to a value, but sometimes they're used by themselves to just be disconnected names

17:44 Chouser: Fib: In Clojure a symbol is an object -- it has data members for namespace and name, each of which is a string. It's essentially a special kind of string.

17:44 rhickey__: More naming fn, given bifurcation, what suffix for stream versions of fns like map/filter/reduce? Candidates are map! and map$

17:44 fun

17:45 Chouser: 'map!' doesn't change the value of the stream it's consuming, right? just generates a stream that's doing mutation internally?

17:46 rhickey__: Chouser: it does change the state of the stream, streams are inherently stateful, each call to next! eats a value

17:47 that's the main reason not to unify with map of seqs

17:47 Chouser: ok, right, sorry.

17:48 Chousuke: hmm, you have many edits to clojure.core in your clojurescript compatibility patch :/

17:48 Chouser: you don't want to consider a suffix of "+"?

17:48 rhickey__: sometimes it will be a "real", io type mutation, like a file based stream, other times a weaker mutation of a cursor on a persistent data structure

17:48 Chouser: Chousuke: yes, and also RT.java

17:48 rhickey__: would consider anything, throwing it out for suggestions

17:49 a benefit of non-alpha is that you could stick it on any existing name

17:50 Chouser: I like the idea of a new suffix that does already mean more generally "mutate" like "!", but I find $ rather unattractive.

17:50 durka: i kind of like $ because it suggests S for stream

17:50 on the other hand it has an overloaded java meaning

17:50 kotarak: why not mapS, then?

17:50 rhickey__: durka: right, that's the argument for it

17:50 kotarak: $ is ugly

17:50 Chouser: look, a stream between two rocks: %

17:50 rhickey__: but people hate $

17:51 Chouser: heh

17:51 danlarkin: map?

17:51 kotarak: maps

17:51 mapEUR ;)

17:51 Chousuke: :P

17:52 rhickey__: ascii please :)

17:52 Chousuke: I guess map: would be too unnoticeable.

17:52 kotarak: map>

17:52 map<

17:52 Chousuke: and looks like a keyword or some kind of label anyway

17:52 Chouser: (reduce% #(- %2 %) strm)

17:53 kotarak: We are approaching Haskell, eh?

17:53 rhickey__: kotarak: not even close

17:53 durka: weren't you considering map* earlier?

17:54 * seems to be the historical lisp character for "subtly different version"

17:54 kotarak: map�, but not ascii....

17:54 Chousuke: map|, but a bit difficult to type :/

17:54 (needs alt on my keyboard)

17:55 kotarak: map-

17:55 danlarkin: there's no good answer :-/

17:55 rhickey__: just FYI, all of these versions will curry, so that hairy Haskell LFE stuff becomes something like this:

17:56 (line-streamer rdr (comp-> (map! inc) (filter! even?) (reduce! + 10)))

17:56 not that it makes sense reduce lines with + :)

17:56 comp-> is like comp in reverse order

17:57 so something like line-streamer can fully encapsulate the use of its resource-based stream

17:57 Chousuke: is it required that they curry like that? or just optional?

17:57 kotarak: Wasn't there a longer discussion about currying before?

17:57 Chousuke: I guess it's just adding an overload without the seq/stream argument

17:58 rhickey__: Chousuke: you want to say partial a lot?

17:58 Chousuke: not really.

17:58 that looks good.

17:58 rhickey__: Chousuke: right, just an arity overload

17:58 karmazilla: did you also change your mind on currying for normal map, filter, reduce?

17:59 * kotarak really wants to do (-> sequence (map foo) (filter bar) (reduce baz))

17:59 rhickey__: karmazilla: nope, these might actually be used curried more often than not

18:00 Chousuke: would it break anything to add similar overloads for the regular seq functions though?

18:01 rhickey__: I would like not to get distracted by that now

18:01 Chousuke: okay, so back to naming... hm.

18:01 * karmazilla thinks \! suffix is good enough - smells like side-effects

18:02 Chousuke: I think I find ! the least offensive. maybe users could be re-educated to just think it means "pay attention!"

18:02 since streams are lossy.

18:02 danlarkin: so there's set! (which means side effect) and map! (which means consumes-a-stream)

18:03 which I guess are similar ideas

18:03 rhickey__: danlarkin: yes, because it consumes a stream by side-effect

18:03 danlarkin: yeah

18:04 rhickey__: the thing is, when you package them up as in the line-streamer call above, they become safe(r)

18:06 danlarkin: see this is where haskell is nice, because with the type system you can say hey! you can't use these things where you're not expecting side effects

18:06 that's my understanding, anyway

18:06 rhickey__: danlarkin: yeah, by tainting your entire call chain

18:07 karmazilla: as Erik Meijer would have said; "but it's the truth!" :)

18:08 rhickey__: right now I've got it so io! blocks and transactions can't overlap, will be interesting to see how far that gets us

18:08 karmazilla: its a straightjacket that keeps you from painting outside the lines (and makes it difficult to play tennis)

18:09 karmazilla: hehe yeah. He also said he liked dynamic languages because if the type system tells you nothing, then it can't lie

18:10 rhickey__: karmazilla: there you go

18:11 technomancy: I don't see how the type system enforcing safety is any safer than using io! blocks.

18:11 for side-effects, I mean

18:11 rhickey__: technomancy: type system can prove things at compile-time, all I can do is throw at runtime

18:12 technomancy: ah, so it just encourages you to spend less time on your test suite then... awesome. =)

18:13 karmazilla: and more time trying to get your code to compile

18:13 technomancy: if you've got a codebase that could sneak an io! block into a transaction without getting caught by your test suite, retrying side-effects is the least of your worries.

18:13 danlarkin: I think we can all agree that clojure should remain dynamically typed :)

18:14 technomancy: danlarkin: sometimes the choir enjoys a good sermon. =)

18:15 rhickey__: so, map!, map-> ???

18:16 danlarkin: map<- is too ugly I guess...

18:16 kotarak: just map<

18:17 danlarkin: yeah map< might do

18:17 karmazilla: I like map!

18:17 rhickey__: (comp (reduce<< + 10) (filter<< even?) (map<< inc))

18:17 Chousuke: reminds me of C++ :P

18:18 durka: i think that's too many characters

18:18 technomancy: map! appeals to /me

18:18 rhickey__: << implies motion that < does not, for me

18:19 kotarak: we also have :>> in condp

18:19 rhickey__: that's right

18:20 danlarkin: naming is always the hardest part of programming... the rest is, what'd Chouser call it? SMOP?

18:20 technomancy: heh; my IRC client wraps nicks in <>s, so that makes this even more punctuationtastic.

18:20 emoticon-oriented-programming

18:26 rhickey__: gotta run - thanks for the feedback

18:32 joma: I like ! like in Scheme I already use it myself

19:26 rhickey__: My slot at ILC 2009 has been confirmed - a full-day tutorial: Clojure in Depth

19:27 technomancy: what's ILC?

19:27 International Lisp Conference?

19:27 rhickey__: yup

19:28 technomancy: cool!

19:28 rhickey__: http://www.international-lisp-conference.org/2009/index

19:29 technomancy: is it in cambridge every year?

19:29 rhickey__: no, moves around, and every 2 years

19:30 technomancy: I'll have to wait for a west coast one. Sounds like fun though.

19:30 rhickey__: I'll also be on a panel at ILC

19:30 2 slots at QCon London

19:31 And 2 irons in the fire for Java One, one talk and one panel, don't know on those yet

19:34 durka: will these be videotaped?

19:35 rhickey__: durka: I don't know, QCon seems very good about that, I'm also doing an interview with InfoQ while I'm there

19:39 Chouser: bleh. FnExpr.parse() calls compile, which demands a dynamic classloader.

19:41 durka: whoops... i tried to install enclojure, and now i have an unbootable netbeans

19:58 danlarkin: Hmmm

19:58 boston for a weekend

20:00 is there a cost for attending?

20:11 rhickey__: danlarkin: they do charge for the conference, I think in the past you could pay per day

20:14 technomancy: what's ballpark range on the cost?

20:15 danlarkin: oh gosh, in 2007 per diem was �150

20:16 technomancy: what city?

20:16 danlarkin: Cambridge, MA -- across the river from boston

20:17 or is it a bay at that point... I don't know

20:18 here's what I'm looking at http://www.international-lisp-conference.org/2007/price-list

20:19 technomancy: ~USD500 for a weekend is not too horrible for a big event like that

20:20 that's only slightly higher than RubyConf, which is pretty small.

20:20 and not in Cambridge

20:20 danlarkin: much higher than pycon :-/

20:21 technomancy: well, I suspect they don't have a lot of big sponsors.

20:21 ITA can only throw so many dollars at Lisp; someone else needs to step up. =)

20:23 danlarkin: yeahhh, pycon was a little sponsor-heavy last year

20:50 duderdo: Hello!

20:51 How do I add entries to my classpath?

20:53 durka: depends on operating system

20:54 generally has to do with the environment variable $CLASSPATH

20:54 or you can use command line args to java

20:54 duderdo: I see, I'm using linux so I just need to make an environment variable?

20:58 durka: yeah

20:58 if you want to make it permanent put it in your ~/.bashrc

20:58 $CLASSPATH is directories separated by :

20:58 duderdo: So I need to update it each time I want to add a library I guess...?

21:04 durka: sorry i wasn't paying attention

21:04 generally yes

21:04 unless you can put the libraries in the same directory and just put the directory on the classpath

21:05 duderdo: No worries. Thanks man.

21:06 durka: if you're looking for references, you can find tons of classpath advice for java, and it all applies

21:10 duderdo: ah that's a good point

21:10 will do. thanks again

21:21 herkel: im doing compressions algorithms for sparce matrices(seminoobish as i am dont count one smething revolutionary :) ). I ws thinking how dynamic typing can save a lot of memoery it seems. since you can choose freely how to represent while a static language(at least the ones that exist) forces you to organize ina certain way. is this correct?

21:47 im doing compressions algorithms for sparce matrices(seminoobish as i am dont count one smething revolutionary :) ). I ws thinking how dynamic typing can save a lot of memoery it seems. since you can choose freely how to represent while a static language(at least the ones that exist) forces you to organize ina certain way. is this correct?

21:49 Chouser: I don't think that's a valid generalization.

Logging service provided by n01se.net