#clojure log - Jan 28 2009

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

0:00 hiredman: knapr: use macroexpand-1 and macroexpand

0:00 examine the code your macro generates for errors

0:04 knapr: looks correct...

0:07 but problem is the function seems to be evaled when it shouldnt be

0:07 (. play-button

0:08 how can that be rewrittwn?

0:09 is

0:09 (. play-button

0:09 (addActionListener

0:09 (.addActionListener play-button ?

0:27 durka42: is java instanceof => clojure isa?

0:28 or is it instance?

0:28 Cark: ,(doc instance?)

0:28 clojurebot: "([c x]); Evaluates x and tests if it is an instance of the class c. Returns true or false"

0:28 Cark: vould be this one

0:28 could

0:34 danlarkin: isa? should be used for derivations I believe

0:34 instance? is for java classes

0:37 hiredman: ,(doc isa?)

0:37 clojurebot: "([child parent] [h child parent]); Returns true if (= child parent), or child is directly or indirectly derived from parent, either via a Java type inheritance relationship or a relationship established via derive. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to the global hierarchy"

0:37 hiredman: ,(isa? String Object)

0:37 clojurebot: true

0:38 hiredman: ,(isa? "" Object)

0:38 clojurebot: false

0:41 hiredman: ,(identical? "" "")

0:41 clojurebot: true

0:49 durka42: (instance? "" String)

0:49 ,(instance? "" String)

0:49 clojurebot: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Class

0:49 durka42: ,(instance? String "")

0:49 clojurebot: true

0:49 durka42: ,(instance? Object "")

0:49 clojurebot: true

0:54 durka42: is try/catch allowed inside catch?

1:14 QTJava doesn't work on Java 6...that is very unfortunate

1:15 hiredman: quicktime java?

1:15 durka42: yes

1:15 QTJava is a wrapper around a 32 bit library

1:16 java 6 mac is 64 bit only

1:16 ergo, no quicktime

1:16 * durka42 downgrades to java 5

1:16 hiredman: you could build your own 32bit jdk

1:17 durka42: it went from an UnsatisfiedLinkError to an ExceptionInitializerError: Quicktime must be initialized

1:17 now that i can deal with

1:17 hiredman: i'm not sure that's the issue

1:17 i don't think you can have java 6, 32 bit, on a mac

1:18 hiredman: if you built one, I think you can

1:19 durka42: hmm

1:19 possibly

1:19 http://paranoid-engineering.blogspot.com/2008/09/java-6-on-32-bit-intel-mac.html

1:19 i don't know if it's worth it, since i can just run this program on java 5

1:20 hiredman: http://landonf.bikemonkey.org/code/macosx/FreeBSD_Java_16_Status_Update.20071112.html

1:22 durka42: tell me that isn't runescape

1:22 hiredman: I dunno

1:23 don't recognize it

1:33 timothypratley: Hi Christophe, thanks for your reply on the group re: zipping... I wonder if you could help with some follow up questions! :)

1:33 say I wanted to construct ((1)) or (2 (1)), starting with 1, then adding a parent

1:38 hiredman: you cannot add parents

1:39 you can take something and add it as a child to a new parent

1:41 ,(-> '() zip/vector-seq (zip/insert-child 1) zip/root)

1:41 clojurebot: java.lang.Exception: No such var: zip/vector-seq

1:41 hiredman: ,(-> '() zip/seq-zip (zip/insert-child 1) zip/root)

1:41 clojurebot: (1)

1:42 hiredman: ,(-> '() zip/seq-zip (zip/insert-child 2) (zip/insert-child (-> '() zip/seq-zip (zip/insert-child 1) zip/root)))

1:42 clojurebot: [((1) 2) {:changed? true}]

1:42 hiredman: ,(-> '() zip/seq-zip (zip/insert-child 2) (zip/insert-child (-> '() zip/seq-zip (zip/insert-child 1) zip/root)) zip/root)

1:42 clojurebot: ((1) 2)

1:42 hiredman: ,(-> '() zip/seq-zip (zip/insert-child 2) (zip/append-child (-> '() zip/seq-zip (zip/insert-child 1) zip/root)) zip/root)

1:42 clojurebot: (2 (1))

1:45 timothypratley: ah neat, thanks hm!

2:00 hiredman: ,(doc zip/zipper)

2:00 clojurebot: "([branch? children make-node root]); Creates a new zipper structure. branch? is a fn that, given a node, returns true if can have children, even if it currently doesn't. children is a fn that, given a branch node, returns a seq of its children. make-node is a fn that, given an existing node and a seq of children, returns a new branch node with the supplied children. root is the root node."

3:19 zakwilson: Reading through some of the Java APIs, I really have to wonder what people are thinking sometimes. Things that seem like they should be a simple method call require instantiating several different types of objects and passing the data through them.

3:26 cads: commas are whitespaces in clojure?

3:26 ayrnieu: yes.

3:27 cads: don't know why that makes me so happy

3:27 but it does :D

3:27 hiredman: it is pretty great

3:27 ,[,]

3:27 hmm

3:27 clojurebot: hello?

3:27 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline hiredman

3:27 hiredman: oh

3:28 <-- retard

3:28 ayrnieu: ,[({1 2 3 4} 1), ({1 2, 3 4} 3)]

3:28 hiredman: needs parens

3:28 ayrnieu: ,(list ({1 2 3 4} 1), ({1 2, 3 4} 3))

3:28 clojurebot: (2 4)

3:28 hiredman: I should fix that

3:29 ayrnieu: ,(list 1,000 1'000)

3:29 clojurebot: (1 0 1 0)

3:29 hiredman: that is weird

3:29 cads: wow that is neat though

3:30 ayrnieu: 1'000 is pretty weird, yes. It'd be nice if that evaluated to 1000

3:30 ,(class '1)

3:30 clojurebot: java.lang.Integer

3:30 hiredman: huh

3:30 cads: ehh, at least it doesn't evaluate to a half open string..

3:30 ayrnieu: (quote 1) is just 1. I guess that's actually not too weird.

3:30 cads: oh wait

3:30 ayrnieu: a half open string?

3:31 * cads comes from ruby

3:31 ayrnieu: -- ah.

3:31 well, clojure can give you that in other ways :-)

3:32 cads: 'astring' is a string in which escaped sequences are printed character for character

3:32 I forgot the semantics of ' in lisps

3:33 hiredman: ,[1]

3:33 clojurebot: [1]

3:33 cads: btw the Clojure for Lisp Programmers talk is pretty damn informative, even for this programmer who's only studied a little lisp

3:33 hiredman: ,{:a}

3:33 clojurebot: java.lang.ArrayIndexOutOfBoundsException: 1

3:35 cads: {:a 1 :steak "sauce"}

3:35 hrm, does it need a comma in front for clojurebot to evaluate?

3:35 (list 1 2 3 4 5 6)

3:35 ayrnieu: yes.

3:36 cads: ,(list 2 3 4)

3:36 clojurebot: (2 3 4)

3:36 cads: ,{:a 1 :steak "sauce"}

3:36 clojurebot: {:a 1, :steak "sauce"}

3:36 cads: ,'(2 3 4)

3:36 clojurebot: (2 3 4)

3:36 cads: ,(2 3 4)

3:36 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn

3:36 cads: yay

3:38 hiredman: your clojurebot on github, is he the same guy as in the channel?

3:38 hiredman: yes

3:39 cads: I always feel like asking permission to use code like this, even when it's open :)

3:40 I wonder if clojurebot and lambdabot will be friends on my system?

3:40 hiredman: clojurebot: paste

3:40 clojurebot: lisppaste8, url

3:40 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

3:40 hiredman: it does play well with others :P

3:41 lambdabot uses '>' and '@' yes?

3:41 cads: yes

3:42 hiredman: cb uses neither of those

3:44 cads: why do people say that java and the JVM are doomed?

3:44 ayrnieu: clojurebot: 2d10

3:44 clojurebot: No entiendo

3:44 hiredman: 2d10

3:44 clojurebot: 6

3:45 cads: 20d100

3:45 clojurebot: 1131

3:45 cads: 20d100

3:45 clojurebot: 873

3:45 cads: : )

3:45 ayrnieu: I don't know, cads, but I know that clojure has seriously rehabilitated Java for me.

3:46 hiredman: ~google the jvm is doomed

3:46 clojurebot: First, out of 2170 results is:

3:46 Java is Doomed!

3:46 http://www.theserverside.com/news/thread.tss?thread_id=46706

3:47 cads: to see java objects wrapped up in lisp syntax is a joy, but it doesn't mean I'll be using java, I could see it dying... the jvm however is open source, I can see it continuing

3:47 ayrnieu: Chouser's book on pragprog, Programming Clojure, builds 'Lancet', an ant without the XML, that actually uses all the ant libraries directly. But the cool part about this is the book's exploration of the ant libraries within clojure.

3:48 hiredman: I don't think it is Chouser's book

3:49 ayrnieu: and the picture is that you not only get all these libraries, but they're pretty comfortablely used.

3:49 ah, OK.

3:49 hiredman: cb sits on a pircbot

3:49 ayrnieu: (def mkdir-task (org.apache.tools.ant.taskdefs.Mkdir.))

3:49 ... didn't mean to put a newline there.

3:50 (map #(.getName %) (.getMethods (class mkdir-task))) <-- the next part. This feels like Ruby, not a famously onerous language.

3:51 hiredman: it's weird, I did some java in school, but was never exposed to it's dynamic reflective facilities

3:51 ayrnieu: ,(map #(symbol (.getName %)) (.getMethods java.io.File))

3:51 clojurebot: (hashCode compareTo compareTo equals toString getName length getParent isAbsolute getCanonicalPath setReadOnly list list delete getPath getParentFile getAbsolutePath getAbsoluteFile getCanonicalFile toURL toURI canRead canWrite exists isDirectory isFile isHidden lastModified createNewFile deleteOnExit listFiles listFiles listFiles mkdir mkdirs renameTo setLastModified setWritable setWritable setReadable setReadable setExe

3:53 cads: yeah, the reflective style, in ruby, allows one to do some pretty magical things

3:55 I don't know if java allows you to create a class during runtime by analyzing other classes and splicing them together selectively

3:55 but I bet the jvm doesn't mind

3:55 ayrnieu: it's called 'proxy' in clojure.

3:55 hiredman: there is some java asm lib that clojure uses

3:55 asm meaning jvm bytecode

3:56 cads: :)

3:56 ayrnieu: (.start (Thread. (proxy [Runnable] [] (run [] (println "I ran!")))))

3:56 hiredman: ayrnieu: clojure fn's are runnable

3:56 ayrnieu: right, that's just to show proxy off.

3:56 zakwilson: Has anybody here done image manipulation stuff with Clojure?

3:57 ayrnieu: I haven't, but you can ask ##java about image manipulation libraries and then just use those :-)

3:57 cads: so you guys think the jvm ecosystem will be around for quite a while, even if java or sun folds?

3:58 zakwilson: I'm looking at Java's API for image stuff... my first reaction is something to the effect of ARRRRGH!

3:58 hiredman: ~google java image manipulation

3:58 clojurebot: First, out of 241000 results is:

3:58 Ultimate Java Image Manipulation

3:58 http://www.javalobby.org/articles/ultimate-image/

3:58 hiredman: ULTIMATE

3:59 cads: that's like, the best!

3:59 ayrnieu: ah, I think you ARRRRGHed earlier.

3:59 zakwilson: That has better results than the "java image processing" query I used before.

3:59 ayrnieu: ~google future of java

3:59 clojurebot: First, out of 523000 results is:

3:59 The Future of Java - The Ponderings of a Hokie

3:59 http://blogs.sun.com/JohnEdstrom/entry/the_future_of_java

3:59 cads: zakwilson: just wondering, what kind of image manipulation do you have in mind?

4:00 hiredman: java seems to be entrenched to the point where it is in the CS curriculum

4:00 which everyone hates, but somehow it is still there

4:00 cads: I am going to be trying some graphics programming in clojure as soon as I learn my first bit

4:00 zakwilson: Simple batch-filtering of folders full of images. Nothing too fancy, and I'm sure I'm reinventing a wheel here.

4:01 ayrnieu: what filtering are you doing?

4:01 cads: there have got to be decent (if not state of the art) image filtering libraries out there

4:02 zakwilson: resizing, color depth reduction, converting to greyscale

4:02 Mostly things that are simple library calls

4:02 cads: I like that about clojure, everything java has, it has...

4:02 zakwilson: That is, if the Java libraries were simple.

4:03 Of course, this being Clojure, said calls will be made on the entire directory listing using pmap.

4:03 cads: so used to hoping someone has ported this or that to ruby, and usually being disappointed when it comes to graphics libraries

4:03 hiredman: well

4:04 zakwilson: I used to call imagemagick from Ruby for the same sort of things.

4:04 hiredman: people like performance will their graphics :P

4:04 with

4:07 zakwilson: This actually has me wondering, is there a "right way" to do multithreaded updates to something shown on a GUI? Polling an agent would work. Would including the GUI update in the action sent to the agent be reasonable?

4:08 What I have in mind is that this program will show how many images have been processed, incrementing every time one finishes.

4:09 hiredman: I think putting the gui object in an agent would be pretty reasonable

4:09 (send-off *gui* mover-bar-over 1)

4:10 zakwilson: I suppose that would.

4:10 cads: so the different parts of the program would inform the gui agent of what needs to be updated, and things would be prevented from jamming up through a transaction scheme?

4:11 hiredman: they would just queue up inline to manipulate the gui

4:11 zakwilson: Agents handle the not-jaming-up internally.

4:11 hiredman: agents queue up actions

4:36 ayrnieu: ,(list *bad-forms*)

4:36 clojurebot: java.lang.Exception: Unable to resolve symbol: *bad-forms* in this context

4:39 hiredman: ,(in-ns *ns*)

4:39 clojurebot: java.lang.ClassCastException: clojure.lang.Namespace cannot be cast to clojure.lang.Symbol

4:39 hiredman: ,*ns*

4:39 clojurebot: #<Namespace sandbox>

4:39 ayrnieu: oh, I found it. Just not spamming the channel with my explorations.

4:39 ,(list hiredman.sandbox/*bad-forms*)

4:39 clojurebot: (#{load-string eval catch def})

4:42 hiredman: If its broken in the morning I will disable binding

4:43 ayrnieu: ,(load-reader (-> (java.io.StringReader. "(eval '(+ 1 2))") (clojure.lang.LineNumberingPushbackReader.)))

4:43 clojurebot: 3

4:44 ayrnieu: src/clj/clojure/core.clj:load-string

5:09 cads: poor sun microsystems

5:10 the last year has not been kind

5:12 A fear I have about the idea of learning a language targeting the java platform is the feeling that it might all just disappear

5:13 Or turn into a dead end.

5:14 And when I read of all the corporate mire surrounding the implementation it makes me queasy.. and again worried what happens to things if the corporate side has a heart attack

5:18 ayrnieu: yes, it would be a fatal blow for the Java community to be reduced to the level of limited industrial support that other languages suffer under already, therefore you should just put your time into those languages.

5:20 this is like saying: it seems likely that the US government will sabotage its economy further, therefore I should to Africa where they already have the bad government but have none of the accumulated capital.

5:20 should move to.

5:20 and the time to make this decision is... right as really brilliant technologies like clojure arise :-)

5:20 cads: well I don't want to be in america when it turns into a third world country

5:21 just because of how bad how fast situations like that can get

5:22 in a way a humble life somewhere else is better, even though I don't get reality TV.

5:22 ayrnieu: thoughts like that should strike you by how poorly they fit the issue.

5:22 cads: they do, you're poking all sorts of holes in my paranoia

5:25 ah well, all in fun then. I'm worried not about limited industrial support, like we have in languages designed by a few very smart outcasts (haskell, say).. but that removal of said corporate support from java would cause people that were left to take a look at it and dump it out of disgust.. but again I see faults in my thinking here too

5:27 I should stop worrying and have fun

5:29 thanks for responding to my admittedly uninformed fears

5:30 and take care all

5:30 ayrnieu: I'm not greatly informed -- I've been avoiding Java for a decade.

5:31 you should ask ##java for ideas about the future of the JVM

8:14 timothypratley: ,(doc seq-zip)

8:14 clojurebot: java.lang.Exception: Unable to resolve var: seq-zip in this context

8:14 timothypratley: ,(doc zip/seq-zip)

8:14 clojurebot: "([root]); Returns a zipper for nested sequences, given a root sequence"

8:14 timothypratley: It seems odd that a 'zipper' is the return 'type'

8:15 but all the zipper functions take a 'loc' as their input

8:16 "Returns the root loc in a zipper..." seems more acurate to me?

8:17 goodnight all :)

8:49 Holcxjo: /msg clojurebot help

10:08 ayrnieu: ,(java.security.MessageDigest/getInstance "MD5"))

10:08 clojurebot: #<Delegate MD5 Message Digest from SUN, <initialized> >

10:09 ayrnieu: ah, duh, doto returns its first argument and not the value of the last form.

10:11 rhickey: anyone get a demo running on Android yet? (other than the first proof-of-concept hello world)

10:12 Holcxjo: Any how-to document how to get even a "hello world" going?

10:13 leafw: Holcxjo: can't you get a REPL running on a terminal?

10:13 ayrnieu: http://github.com/Nafai77/helloandroid/

10:14 Holcxjo: leafw: Haven't even looked so far -- searched the mailing list a few weeks ago for "Android" and didn't come up with much. I confess, I haven't looked into it too much yet...

10:14 gnuvince: Good day everyone

10:15 Holcxjo: ayrnieu: Thanks

10:16 Lau_of_DK: Hey gnuvince

10:25 achim_: i had a tiny minesweeper-like thing running on android, but i ran into some gfx/ui issues i didn't have time to investigate. also, the emulator logs reported ~30 secs of nothing but GCing (and some app-start timeout) before the app even started - anybody else seen this?

10:35 BigTom: clojurebot: Am I properly connected?

10:35 clojurebot: It's greek to me.

10:41 jkantz: any advice on debugging runtime exceptions?

10:41 whenever I run into one I get things like:

10:41 0: clojure.lang.Compiler.eval(Compiler.java:4179)

10:41 and it's always a pain to find the offending code

10:41 because there's nothing useful in the backtrace

10:42 danlarkin: jkantz: I know what you mean

10:45 hoeck: jkantz: in slime, rethrowing the cause of the exception until you hit the "real" cause helps sometimes

10:47 rhickey: clojurebot: chart?

10:47 clojurebot: Gabh mo leithsc�al?

10:50 rhickey: jkantz: you can paste a stack trace

10:50 lisppaste8: url

10:50 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

11:13 AWizzArd: rhickey: if for some reason the JVM would not be a good target anymore for Clojure, and you would want to port it to .NET, what do you think how much time it would require to get a Clojure on .NET that works about as good as the current one on the JVM?

11:14 ayrnieu: wizzard - http://dotlisp.sourceforge.net/

11:14 AWizzArd: I am talking about Clojure.

11:14 Rich developed Clojure in the beginning on both VMs for some time.

11:15 And while I think that the JVM is the better target and that the JVM will stay around for a decade or more, I would just like to know how much time it may require to port it over.

11:16 C# and Java are not so drastically different. Rich learned over the time what is good for Clojure and would not have to go through that again when porting it.

11:16 Also lots of Clojure is written in pretty portable Clojure.

11:19 lisppaste8: jkantz pasted "untitled" at http://paste.lisp.org/display/74421

11:22 jkantz: er, ignore that paste, rethrowing in slime as hoek suggested revealed a better stack trace

11:24 gnuvince: AWizzArd: in the Boston Lisp presentation, he explained that maintaining both versions would require to go with the least common denominator for features to be compatible on both platforms, which would hinder Clojure.

11:24 ayrnieu: but if you want to work on his old .NET version, there's that link I pasted.

11:25 AWizzArd: right, but in my hypothetical situation it would be different, because in that situation Rich thinks about the JVM as a no longer acceptable target. So, only .NET features would be considered.

11:25 Of course, a port would be a slightly different Clojure.

11:26 cgrand: AWizzard: http://clojure-log.n01se.net/date/2009-01-13.html#10:41

11:26 ayrnieu: hypothetically, it would take one day, and all the incestuous Java-Clojure stuff would work on .NET's JVM emulation.

11:27 hm, incestuous is the wrong word.

11:28 AWizzArd: cgrand: thanks for the link. So it seems someone is already working on a port of Clojure for .NET.

11:35 rhickey: AWizzArd: the .Net port is coming to clojure-contrib soon

11:35 stay tuned

11:36 AWizzArd: the JVM remains a great target IMO

11:38 AWizzArd: I very much agree. Personally I am not interested in a .NET version. Sun is still alive and enough companies invested billions into Java. In the worst case Sun will start a new company, only responsible for Java, if they should go bankrupt.

11:38 maybe they'll get rid of their hardware branch

11:44 rhickey: http://s-expressions.com/2009/01/28/startup-logbook-clojure-in-production-release-v01/

11:45 danm_: meh, sun has plenty of cash

11:46 danlarkin: rhickey: very neat

11:46 danm_: pretty cool

11:53 MarkVolkmann: I know I can use the keys function to get all the keys in a map. What's the function to get all the values from a map?

11:54 hoeck: MarkVolkmann: vals

11:54 MarkVolkmann: Thanks!

12:29 scottj: What's the easiest way to sort a vector of maps by one of the map keys?

12:29 eyeris: What is the rational behind take-while expecting true and drop-while expecting nil as opposed to false?

12:29 or even true?

12:30 pred returning true is the most intuitive to me.

12:30 ayrnieu: ,(sort #(compare (:a %1) (:a %2)) [{:a 1 :b 2} {:a -1 :b 3} {:a 3 :b 3}])

12:30 clojurebot: ({:a -1, :b 3} {:a 1, :b 2} {:a 3, :b 3})

12:31 eyeris: If pred returns true then you can read it as "drop-while this condition holds" or "take while this condition holds"

12:31 kotarak: (doc sort-by)

12:31 clojurebot: Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator.; arglists ([keyfn coll] [keyfn comp coll])

12:32 zakwilson: I'm trying to speed up an algorithm using unchecked math and getting the opposite result. Has anybody had a similar issue?

12:33 eyeris: zakwilson paste the code somewhere?

12:33 scottj: kotarak, ayrnieu: thanks!

12:35 noidi: eyeris, seems like the docs are just out of date

12:35 for drop-while

12:35 ,(drop-while (fn [x] (< x 5)) (range 10))

12:35 clojurebot: (5 6 7 8 9)

12:36 lisppaste8: zakwilson pasted "The unchecked version is much slower" at http://paste.lisp.org/display/74424

12:36 noidi: (doc drop-while)

12:36 clojurebot: Returns a lazy seq of the items in coll starting from the first item for which (pred item) returns nil.; arglists ([pred coll])

12:36 eyeris: noidi Thanks.

12:36 cgrand1: scottj: (sort #(compare (:key %1) (:key %2)) [{:key 2}{:key 1}])

12:36 ayrnieu: that doc is correct.

12:36 skoptelov: clojure-dev question: can i run .clj file from IDE?

12:37 eyeris: zakwilson so by "the opposite" you mean that it slowed down instead of speeding up

12:37 noidi: ,(< 6 5)

12:37 clojurebot: false

12:37 eyeris: rather than the result of the calculation being wrong

12:37 noidi: ^-- not nil

12:37 ozy`: is it possible to perform implicit lifting in clojure? e.g. could (/ sum length) ever mean #(/ (sum %) (length %))?

12:37 zakwilson: Right. The result of the calculation is the same, but the unchecked version is a couple orders of magnatude slower.

12:37 ayrnieu: oops. OK.

12:37 cgrand1: scottj: or (sort #(apply compare (map :key %&)) [{:key 2}{:key 1}])

12:38 eyeris: zakwilson how are you testing the running time?

12:38 I just want to make sure my tests are the same.

12:38 (e.g. on a different JVM)

12:39 zakwilson: grey-px is called in an inner loop of another function, once per pixel in an image. I'm timing that function with (time)

12:39 ayrnieu: ozy - conceivable; unlikely.

12:40 eyeris: zakwilson and px is just a 32-bit int?

12:40 zakwilson: Yes

12:40 I could paste the whole file and you can test it with real images if you would prefer.

12:40 eyeris: No need

12:40 One sec

12:41 ozy`: ayrnieu: just because there would be so little syntactic difference between that and the more explicit version?

12:42 (and thus more trouble than it's worth?)

12:42 ayrnieu: ozy - not because it's useless and troublesome, but because it has severe linguistic costs.

12:42 eyeris: zakwilson I do need unchecked-add though

12:43 zakwilson: eyeris: What do you mean?

12:43 eyeris: erm, nvm

12:43 Typo

12:43 ozy`: ayrnieu: in what sense?

12:43 eyeris: You missed the e in one call. I thought maybe it was a wrapper

12:44 zakwilson: Oops

12:44 ayrnieu: ((foo bar baz) & args) <-- does (foo bar baz) evaluate to a function, or is it lifted? It's possible for clojure to analyze bar and baz and say that lifting only makes sense here, but how can the *programmer* make this determination?

12:44 zakwilson: I had a wrapper, unchecked-sum (reduce unchecked-add ...), but that was very slow as well.

12:45 shoover`: rhickey: prod that .NET author! I'm giving a presentation to a .NET group next month and I've love to show them some bona fide CLR action!

12:46 ozy`: ayrnieu: ah, indeed

12:46 ayrnieu: that's only the first issue, and that's already awful. The others are in the same vein, of interpretations that switch between "oh, this is lifted" and "oh, this is normal" when very small changes happen, even changes far away from the expression.

12:47 ozy`: better to leave it to strongly typed languages, then? :p

12:47 drewr: How can I test if something is an array?

12:47 eyeris: zakwilson I get the same results. I'm not sure why.

12:48 cooldude127: so is test-is the de-facto clojure testing framework?

12:48 ayrnieu: ,(.isArray (.getClass (make-array Boolean/TYPE 10)))

12:48 clojurebot: true

12:49 drewr: ayrnieu: thanks!

12:51 zakwilson: eyeris: thanks for looking at it.

12:53 eyeris: zakwilson Could it be that unchecked-add needs to create a Java Integer?

12:54 Chouser: no

12:55 unchecked-add when used in a position that a macro could be used will generate code that directly calls a Java method that expects primitives

12:57 lisppaste8: zakwilson annotated #74424 with "Fixed typo" at http://paste.lisp.org/display/74424#1

12:57 ayrnieu: ozy - full-program analysis with static typing and lots of type annotations can free you to do a lot of useless and troublesome things, yes :-)

12:58 zakwilson: Chouser: the version I pasted there using unchecked math is MUCH slower than the basic version.

12:58 Chouser: huh.

12:58 zakwilson: And YourKit shows is spending most of its time doing unchecked-add.

12:58 rhickey: zakwilson: there is no primitive support for shifts yet

12:59 technomancy: cooldude127: seems like it

13:03 lisppaste8: rhickey annotated #74424 with "faster grey-px" at http://paste.lisp.org/display/74424#2

13:04 rhickey: that's about 6x faster

13:04 ayrnieu: drewr - (.isArray (class ...)) also works. I used .getClass following a question in ##java

13:04 zakwilson: rhickey: Thanks!

13:05 I just tested it. I'm getting about 2x faster than my original version.

13:05 rhickey: zakwilson: should be 6x faster for you too, ar eyou running with -server?

13:06 eyeris: Are Strings collections?

13:06 ayrnieu: ,(coll? "s")

13:06 clojurebot: false

13:06 drewr: ayrnieu: I really need (array? ...)

13:06 zakwilson: I think so. This is running inside Slime. I'm not exactly sure what the startup options are.

13:06 eyeris: ayrnieu Thanks

13:07 drewr: ayrnieu: I'm using a lib (net.sf.json) that thinks (array? [1 2 3]) == true

13:07 rhickey: zakwilson: (time (last (map grey-px (range 1000000))))

13:07 drewr: so I have to do my own logic to figure out whether to use JSONObject/fromObject or JSONArray/fromObject

13:07 lame-o

13:08 abstraction leak at its worst

13:08 danlarkin: drewr: *ahem* http://github.com/danlarkin/clojure-json/tree/master

13:08 drewr: danlarkin: never!

13:08 :-)

13:08 danlarkin: love it!

13:10 ayrnieu: ,(map class ["" () [] nil 1 1.0 1/2 {} #{} #""])

13:10 clojurebot: (java.lang.String clojure.lang.PersistentList$EmptyList clojure.lang.PersistentVector nil java.lang.Integer java.lang.Double clojure.lang.Ratio clojure.lang.PersistentArrayMap clojure.lang.PersistentHashSet java.util.regex.Pattern)

13:10 zakwilson: rhickey: Your version is just over 4x faster on that, but significantly less so when used to process an image. I'm going to profile it again.

13:11 hiredman: clojurebot uses clojure-json for googling btw

13:11 danlarkin: *cheer*

13:11 ayrnieu: hiredman, I broke clojurebot right after you left, if you didn't see

13:11 kotarak: One should not rely in the specific type.

13:11 s/in/on

13:11 hiredman: ayrnieu: still works, so it is not broken

13:12 ayrnieu: I mean 'broke' as in 'I can call eval, etc.' on it.

13:12 hiredman: the only reason to not allow eval is catch

13:12 ayrnieu: ah, OK.

13:13 hiredman: catch can catch the exception that Thread.stop generates

13:13 and dos cb

13:18 erohtar__: rhickey: thanks for clojure, we're using it in production

13:19 rhickey: i've written it up here - http://s-expressions.com/2009/01/28/startup-logbook-clojure-in-production-release-v01/

13:20 danlarkin: thanks for ur help with my clojure-json questions - we have something in production now

13:21 danlarkin: erohtar__: glad to hear it!

13:22 rhickey: erohtar__: you're welcome!

13:32 cooldude127: what is the right way to signal an error from my function? should i use (assert) if it's for like a precondition?

13:33 danlarkin: cooldude127: assertions are for preconditions yes

13:34 cooldude127: danlarkin: cool, but what about other errors, are we still using just java exceptions?

13:36 danlarkin: Chouser (I think) whipped up an error smuggling library-of-sorts... I think it's on lisppaste somewhere

13:36 but yeah I think generally we're just using java exceptions

13:37 cooldude127: ok

13:46 zakwilson: rhickey: After some more profiling and additional type annotations in the rest of the program, grey-px converts a 10 megapixel image to greyscale in 6 seconds on my machine. Thanks!

13:46 rhickey: zakwilson: np

13:48 Chouser: danlarkin: that's for CL-condition-like features?

13:48 danlarkin: Chouser: yessir

13:48 Chouser: ok

13:51 danlarkin: it was you, right?

13:53 Chouser: I was kicking around some ideas, yeah.

13:54 oh!

13:54 I completely misunderstood what you were saying.

13:54 danlarkin: I thought you were telling me that *you* had whipped up something.

13:55 danlarkin: Chouser: that happens to me a lot :'( oh, nono

13:55 Chouser: and I was thinking "that's nice, maybe I won't have to"

13:55 dreish: rhickey: As long as it's Thanking Hour, thanks for making the first Lisp that I find fun to use _and_ very practical.

13:56 rhickey: dreish: you're quite welcome!

13:57 Chouser: rhickey: thanks for getting me hooked into a community that now consumes all my spare time, just to keep up with the mailing list.

13:57 dreish: Quick question about gensyms, though: It's possible for them to collide with "regular" symbols if you have the bad habit of ending symbols with numbers. Is that a known issue at a relatively low priority, or just not considered important enough at all?

13:57 rhickey: Chouser: sure thing!

13:58 dreish: I would think it would be possible to someday make class Gensym extend Symbol and override equals() with an identity test, and print with something like #:ns/name

13:58 rhickey: Chouser: what's this "spare time" thing of which you speak?

13:59 kotarak: spare time

13:59 noun

13:59 time that is not taken up by one's usual activities; leisure time.

13:59 Chouser: rhickey: that's all the time that I'm (a) not being paid to do other work and (b) not fixing burst pipes in the basement.

14:00 * rhickey remembers spare time...

14:01 dreish: ,(gensym)

14:01 clojurebot: G__1528

14:01 dreish: ,(= (gensym) 'G__1532)

14:01 clojurebot: true

14:01 dreish: Can't do that in Common Lisp no matter how hard you try.

14:01 rhickey: dreish: I consider that a theoretical problem, but not a practical one

14:01 dreish: ok

14:02 rhickey: double underscores being quite ugly

14:02 drewr: danlarkin: any particular reason you use :as with :use?

14:02 dreish: I've never created a symbol with a number at the end anyway. It sounds like a nasty habit.

14:02 Chouser: even single underscores are pretty uncommon.

14:02 drewr: danlarkin: e.g., http://github.com/danlarkin/clojure-json/blob/9baaec1f1f714751b7be87974b41c21d1e5a3d6f/test/test.clj

14:02 * dreish quickly checks code. ...

14:02 danlarkin: drewr: in clojure-json? just an oversight I haven't yet fixed :)

14:02 Chouser: I was thinking about taking a crack at a patch to stuff line numbers into gensym names.

14:03 dreish: Well, if you do # auto-gensyms, there aren't any underscores.

14:03 Oh, yes there are.

14:03 Chouser: ,(identity `a#)

14:03 clojurebot: a__1533__auto__

14:03 dreish: Sorry, I either had an old version somewhere, or a brain malfunction.

14:03 drewr: danlarkin: k

14:03 Chouser: a whole raft of them :-)

14:04 drewr: danlarkin: also, how do you handle Dates?

14:04 dreish: Yeah, that's pretty theoretical then.

14:04 drewr: that's what I'm struggling with at the moment

14:04 no existing lib seems to use ISO8601

14:04 rather, a hash of all the bean attrs

14:05 danlarkin: drewr: I don't handle dates -- but you can! check out the docstring for add-encoder

14:06 drewr: danlarkin: Glossed over that. Nice.

14:09 danlarkin: drewr: if you do anything serious with custom encoders let me know, I might need to make some things from encoder.clj public instead of private

14:10 drewr: danlarkin: it's about to get real serious up in here

14:20 hiredman: clojurebot: length?

14:20 clojurebot: Huh?

14:20 hiredman: clojurebot: length is <reply> count

14:20 clojurebot: 'Sea, mhuise.

14:27 cp2: anyone around? im in need of help

14:27 danlarkin: cp2: ask away, anyone who can help will offer it

14:27 cp2: right then

14:28 clojure seems to be ignoring the classes i add to the classpath, both while in the repl and if i add it to the java arguments

14:28 as in, (add-classpath "file:///c:/bcel/bcel-5.2.jar") does not work

14:28 nor does java -cp .;c:/bcel/bcel-5.2.jar -jar clojure.jar

14:29 i cant import any of the classes in the jar, results in ClassNotFoundException

14:29 danlarkin: cp2: I think you can't muck with the classpath if you use -jar

14:29 StartsWithK: cp2: you can't use -cp and -jar

14:29 cooldude127: is the floor operation in clojure (Math/floor num) ?

14:30 cp2: well, that would explain part of it

14:30 StartsWithK: cooldude127: yes

14:30 cp2: it doesnt work from the emacs repl either (im using clojure box)

14:30 hiredman: ,(doc floor)

14:30 clojurebot: java.lang.Exception: Unable to resolve var: floor in this context

14:30 hiredman: add-classpath is funky

14:30 I would not rely on it

14:31 cp2: how would i go about adding to the classpath from emacs then?

14:31 hiredman: there is some slime thing

14:31 I don't emacs, so I don't know offhand

14:32 cp2: this seems to be what im looking for http://gnuvince.wordpress.com/2009/01/24/emacs-function-for-clojure-users/

14:33 gnuvince: cp2: beware, a part of the code is truncated; the last word is slime-lisp-implementations with all closing parens.

14:33 cp2: yeah, i noticed

14:33 oh haha, is that your wordpress?

14:34 gnuvince: Yes

14:34 drewr: danlarkin: add-encoder works ok. I'm not sure I like the abstraction though. I'll be playing with it.

14:34 eyeris: Clojureql returns an map with lowercase versions of the column names selected as keys. Is this a clojureql restriction or is it a clojure restriction?

14:35 cp2: well, thank you

14:35 danlarkin: drewr: good to hear it's working for you, what do you like?

14:35 Chouser: eyeris: clojure keywords can have capital letters, if that's what you're asking.

14:36 eyeris: Chouser thanks.

14:36 Chouser: though most SQL databases allow columns with spaces in their names, and clojure doesn't (or shouldn't) allow that.

14:37 drewr: danlarkin: I like that it's all clojure, for starters.

14:37 eyeris: I wonder why ClojureQL converts them to lowercase. I just found the code responsible, but it doesn't give much insight.

14:37 danlarkin: Chouser: are you sure it doesn't? (keyword "has spaces")

14:38 drewr: oops sorry! I mean't what _don't_ you like

14:38 Chouser: danlarkin: but that's not readable again: http://code.google.com/p/clojure/issues/detail?id=13

14:39 eyeris: ,(keyword "yes sir")

14:39 clojurebot: :yes sir

14:39 Chouser: thus my "(or shouldn't)" qualifier above. :-)

14:39 danlarkin: Chouser: uh oh... that's going to break clojure-json :)

14:40 I would rather see that bug stay open

14:42 hiredman: :(

14:42 Chouser: hm, json allows spaces in its keys, doesn't it.

14:42 danlarkin: Chouser: yeah

14:43 Chouser: not only spaces but other invalid keyword type things

14:43 cooldude127: i'm really digging the way test-is groups tests and functions

14:43 Chouser: for keys that are invalid keywords, you could just use strings.

14:43 danlarkin: or I should say non-readable keywords

14:44 Chouser: even as it is users would have to specify non-readable keys differently.

14:44 (keyword "foo bar") since :foo bar isn't right

14:44 danlarkin: Hm that's true

14:45 Chouser: so with that change, it'd actually be easier. :normal vs. "you asked for it"

14:45 danlarkin: yeah, maybe I'll make that change

14:45 lawl: does anyone here know lisp??

14:46 danlarkin: I'm also exploiting it for my open purposes by creating a (symbol ",")

14:46 drewr: danlarkin: It's not that I definitely don't like it. The return value just seems very brittle.

14:46 dreish: lawl: I'm strictly an Acorn BASIC programmer.

14:46 drewr: Including my own indentation? Why can't it use whatever the rest of the serialization is using?

14:47 danlarkin: drewr: well because if you want to encode your <whatever> as a collection you have to deal with your own indentation

14:47 dreish: 10 PRINT "LOOK AROUND YOU";

14:47 20 GOTO 10

14:47 RUN

14:48 drewr: danlarkin: yeah, I see what you mean.

14:48 danlarkin: drewr: like maybe your <whatever> is a collection of collections of hashes, I don't know how to deal with that

14:48 lawl: wat is clojure coded in

14:48 danlarkin: lawl: APL

14:49 lawl: really

14:49 bitbckt: danlarkin: I thought it was Malbolge?

14:50 dreish: bitbckt: Used to be, but that branch is no longer maintained.

14:52 lawl: On the off chance that was a serious question, here's a nice pie chart that answers it: http://github.com/kevinoneill/clojure/graphs/languages

14:52 hiredman: dreish: nice

14:52 lawl: they should have made it yellow

14:52 Chousuke: heh

14:52 lawl: clojure is programmed in itself??

14:52 bitbckt: yes, yellow would have made that graph much more legible

14:53 ayrnieu: that's *normal*, lawl.

14:53 Chousuke: lawl: there's the standard library

14:53 dreish: I think most Lisps implement a small core in another language, and then the rest is written using that core.

14:53 Chousuke: though even some of the java code actually emits clojure.

14:53 Chouser: that's even true of most C compilers

14:54 Chousuke: the bootstrapping problem is interesting, though

14:54 zakwilson: I think SBCL has a tiny assembly core and the rest is CL.

14:54 danlarkin: drewr: although the indentation is one of the least elegant parts about the encoder, I admit. But it works! so I'm reluctant to mess with it

14:56 Chousuke: you code a crappy compiler; then compile a less crappy compiler using the crappy compiler, and use the result for subsequent compilations :P

14:56 ayrnieu: and then you have metacompiling forths. They aren't 'writtin in' the long-discarded assembler that they crawled out of. A language that's completely written in another language is probably something esoteric, like befunge.

14:57 lawl: SUP GUYS

14:57 dreish: It ought to be possible to rewrite the Java parts using ASM without any change in features or performance, right? And then wouldn't it be possible to rewrite ASM using Clojure?

14:57 lawl: assembler?

14:57 Chousuke: dreish: yeah :P

14:58 dreish: ASM is a Java library that allows you to generate Java classes on the fly, at runtime.

14:58 Chousuke: but needing clojure to compile clojure would make it unnecessarily complex I think

14:58 dreish: From what little I've learned from looking at it, it seems significantly higher level than what I'd think of as assembler.

14:58 Chousuke: since you can just use java.

14:59 dreish: What if you have just a JRE, no JDK?

14:59 And you just want to download a jar that will let you compile future versions?

15:00 Chousuke: My guess is compiling clojure would depend on the JDK in any case.

15:00 walters: it shouldn't actually I believe

15:00 danlarkin: Rich has said a lot of what's written in java now could be rewritten in clojure, but it just isn't worth messing with right now because it works and he'd rather spend time on other things

15:00 walters: the JRE can load bytecode just fine

15:00 lawl: does anyoen else think lisp sux

15:00 walters: and ASM generates bytecode directly, it doesn't run javac

15:00 dreish: danlarkin: Yes, thankfully he's not the sort of person to meander down side paths like that.

15:01 danlarkin: aye aye

15:01 walters: the JDK is mostly about javac, javadocs etc. i think they're also shipping visualvm with it too now

15:01 dreish: lawl indeed.

15:01 hiredman: what a misguided young man

15:02 dreish: Meh, I'm sure he thought it would be funny.

15:02 danlarkin: a troll, just forget about him :-/

15:02 dreish: But instead of running into a bunch of tightly-wound weirdos, he quickly got out-smartassed.

15:03 Chousuke: a troll, here? this is officially an IRC channel now.

15:03 technomancy: clojurebot: #clojure

15:03 clojurebot: this is not IRC, this is #clojure. We aspire to better than that.

15:03 technomancy: ...

15:03 bitbckt: Lies.

15:04 hiredman: clojurebot: trolls is <reply>according to troll lore living beings move backwards through time

15:04 clojurebot: In Ordnung

15:05 ayrnieu: Chousuke, trolls are like harmless particles that people have terrible allergies to. If you don't start shouting and blowing your nose at them, they're just misguided young men.

15:06 lawl: shutup idiots

15:06 dreish: Just out of curiosity, do we have any ops?

15:06 ayrnieu: /msg chanserv access #clojure list

15:06 dreish: thx, I'm an irc newbie.

15:07 danlarkin: ~seen jcowan

15:07 clojurebot: no, I have not seen seen jcowan

15:08 ayrnieu: /msg nickserv info jcowan

15:08 dreish: Last seen Mar 07 2008, from searching n01se.net

15:09 Chouser: it might be wise for someone to ask him to share some privs with a couple others who are here more often.

15:11 danlarkin: maybe you or rich, someone he'd know

15:11 RobertFischer: Hey there. What would people consider the major utilities/frameworks for/based on Clojure?

15:12 technomancy: RobertFischer: like apart from contrib?

15:12 RobertFischer: for web stuff compojure seems to be the leader.

15:12 Chouser: rhickey: would you consider asking jcowan to share channel privs with yourself and/or others here you'd trust?

15:14 RobertFischer: technomancy: Yeah, apart from contrib.

15:14 I'm just curious to see what people are doing with Clojure.

15:14 Aside from talking about how awesome it is. :)

15:14 danm_: heh

15:14 ayrnieu: http://github.com/languages/Clojure

15:14 technomancy: oh sweet; Mire made it on to most watched

15:15 must be a slow week; it also made it on to most forked. =)

15:15 dreish: That page makes me want to push more often.

15:16 technomancy: dreish: we can do it; we can take 22nd place and knock Scala into 23rd!

15:16 RobertFischer: unfortunately talking about how awesome it is turns out to be a pretty time-consuming activity.

15:16 RobertFischer: Apparently.

15:17 technomancy: so we outsource our programming; we make macros write our code for us.

15:17 saves a lot of time in the end

15:18 danm_: sounds good

15:18 Chouser: technomancy: ha!

15:18 dreish: It looks like 11% Clojure isn't enough to get on the Clojure page.

15:20 Chousuke: github is dominated by ruby and javascript. Interesting :P

15:21 _knapr_: robertfischer: contrib is awesome for some extra useful stuff. compojure is a good webframework. for GUIs I suggest swing+miglayout+contrib-miglayout

15:21 technomancy: well it's written in Ruby and hosts Rails

15:21 Chouser: is that in LOC?

15:21 cooldude127: i would guess num of projects

15:22 dreish: I'd guess number of projects, but they don't say. Could be number of watchers.

15:22 hiredman: crap, that is a lot of javascript

15:22 technomancy: I think it's weighted though; active projects count more

15:25 RobertFischer: They break down projects into their constituent languages: http://gist.github.com/RobertFischer/cornerstone/graphs/languages

15:25 And I'm pretty sure that's LOC.

15:25 dreish: Wow, that's some project.

15:26 RobertFischer: I don't mess around. :)

15:27 dreish: I just meant it's an unusual collection of languages.

15:29 RobertFischer: Not really. Predominantly Groovy/Java, with Java bridged to C for mathematical work, Perl for the boot-strap/install script, and Scala for its parser-combinators.

15:29 Although I'm starting to wonder if that would have been better implemented in Clojure.

15:29 cooldude127: am i allowed to modify a namespace? like i want to remove a mapping from it, how do i do that?

15:29 RobertFischer: (Don't tell #scala I said that.)

15:29 hiredman: ,(doc un-map)

15:29 clojurebot: java.lang.Exception: Unable to resolve var: un-map in this context

15:29 hiredman: ,(doc unmap)

15:29 clojurebot: java.lang.Exception: Unable to resolve var: unmap in this context

15:29 hiredman: come on

15:29 cooldude127: (doc unmap)

15:29 clojurebot: Huh?

15:30 hiredman: ,(doc ns-unmap)

15:30 clojurebot: "([ns sym]); Removes the mappings for the symbol from the namespace."

15:30 cooldude127: (doc ns-unmap)

15:30 clojurebot: Removes the mappings for the symbol from the namespace.; arglists ([ns sym])

15:31 Lau_of_DK: Good evening gents

15:31 cooldude127: good afternoon

15:37 brianh: ok. i must be having a senior moment. why would 'mod' be restricted to ints only?

15:37 RobertFischer: The definition of "mod" is in the domain of ints.

15:37 cooldude127: brianh: the function is rem in clojure

15:37 hiredman: cooldude127: actually

15:37 ,(mod 30 4)

15:37 clojurebot: 2

15:38 cooldude127: if i try that in my repl, it doesn't work

15:38 brianh: it's in the latest core

15:38 cooldude127: oh

15:38 hiredman: clojurebot: latest?

15:38 clojurebot: latest is 1235

15:38 cooldude127: what's the diff?

15:39 hiredman: hmmmm

15:40 that is incorrect

15:40 I have 1237 here

15:40 cooldude127: lol

15:40 dreish: In the future, mod gets removed.

15:40 You have a future version. Mystery solved.

15:40 hiredman: huh

15:40 no I have 1235

15:40 brianh: so using mod for say, unit circle degrees (as double), is considered mathematically incorrect?

15:41 hiredman: must have misread that

15:41 cp2: i want to avoid using an array to hold the state of keys, but i cant really think of any other way to do it

15:41 any suggestions?

15:41 hiredman: ah, rev 1237, but the last change was rev 1235

15:41 Chouser: brianh: 'rem' works fine

15:41 cooldude127: brianh: just use rem

15:41 dreish: ,(rem 2.3 1.2)

15:41 clojurebot: 1.0999999999999999

15:42 ayrnieu: cp2 - if you aren't continuing from a conversation I don't remember, please ask a complete question.

15:42 cooldude127: what was the point of adding mod?

15:42 cp2: ayrnieu i would consider that complete, but if you wish

15:42 Chouser: (prn (mod -5 2) (rem -5 2))

15:42 ,(prn (mod -5 2) (rem -5 2))

15:43 clojurebot: 1 -1

15:43 brianh: I did. just wasn't sure what I was missing ;)

15:43 cp2: is there a better way than using a java array to hold the state of keys? i cant think of any other way

15:43 cooldude127: cp2: what do you mean by the "state of keys"

15:43 ayrnieu: cp2 - what state? What keys? How are you going to use this state?

15:43 cooldude127: we're not sure what problem domain this is

15:43 cp2: as in, i want to store whether or not a key (on a keyboard..) is pressed

15:44 ayrnieu: hah, see, this is not on the same planet as what I assumed.

15:44 dreish: cp2: Ah, I think everyone was guessing either keys in a hash, or keywords.

15:44 cp2: yes

15:44 sorry, should have been more clear

15:44 cooldude127: cp2: ref of a vector?

15:44 Chouser: ref of a set?

15:44 cp2: eh, could you show me example?

15:45 dreish: ,(ref #{'shift 'ctrl 'a})

15:45 clojurebot: #<Ref clojure.lang.Ref@d8a125>

15:47 cp2: hrm

15:47 i think i see what you mean

15:47 hiredman: ,(let [keys (ref #{'shift 'ctrl 'a})] (alter keys (partial select #(not= 'ctrl)) keys)

15:47 clojurebot: Eval-in-box threw an exception:EOF while reading

15:47 hiredman: ,(let [keys (ref #{'shift 'ctrl 'a})] (alter keys (partial select #(not= 'ctrl))) keys)

15:47 clojurebot: java.lang.Exception: Unable to resolve symbol: select in this context

15:47 dreish: Then (dosync (alter some-var-holding-the-above disj 'shift))

15:47 hiredman: ,(let [keys (ref #{'shift 'ctrl 'a})] (alter keys (partial clojure.set/select #(not= 'ctrl))) keys)

15:47 clojurebot: java.lang.IllegalStateException: No transaction running

15:48 hiredman: bah

15:48 you get the idea

15:48 cp2: ye

15:48 hiredman: ,(doc disj)

15:48 clojurebot: "([set] [set key] [set key & ks]); disj[oin]. Returns a new set of the same (hashed/sorted) type, that does not contain key(s)."

15:48 hiredman: huh

15:48 some new everyday

15:48 something

15:48 cp2: thanks dreish, ill try it out

15:49 Lau_of_DK: Gentlemen, for those of you who use Git - Try doing a git-log in a git-repo and watch the structure of the result, Zero ident 3 lines, more indent on the next lines, and then the commit finished with x number of lines with 0 identing again as far as I remember. What would be the intelligent way to split that up into an array or a vector? A dumb approach could be (.split git-log "commit "), this will work if the entire log does not

15:49 contain the word "commit" anywhere in the descriptions :)

15:50 dreish: Lau_of_DK: with Perl ;)

15:51 _knapr_: how do I do something in a catcha nd how do I try multiple functions?

15:51 Lau_of_DK: dreish: It we work from the assumption that perl is the vomit of programming, have you got any other suggestions? :)

15:51 hiredman: like line-seq but break on \ncommit instead of \n

15:51 dreish: Ooh, them's fightin' words.

15:52 Lau_of_DK: Yes, giving that bad advice on #CLOJURE is a crime :)

15:53 cp2: so dreish, what would be the "opposite" of disj then

15:53 dreish: I'm sure it would be fun to do in Clojure, but if I were to do it I know I'd write it in Perl in my head first, and then try to shoehorn that program into Clojure, so ... I don't know why I'm even speaking up.

15:53 cooldude127: cp2: conj

15:53 hiredman: _knapr_: http://clojure.org/special_forms try catch is near the bottom

15:53 cp2: oh right

15:53 makes sense

15:54 thanks much, i got it now

15:56 _knapr_: can agents or refs notify each other?

15:57 durka42: agents can have watchers

15:57 both can have validation functions

15:57 Chouser: both can have watchers now

15:57 ,(defmethod print-method clojure.lang.IRef [o w] (.write w (format "#<%s@%x: %s>" (.getSimpleName (class o)) (System/identityHashCode o) (pr-str @o))))

15:57 clojurebot: #<MultiFn clojure.lang.MultiFn@385715>

15:57 Chouser: ,(ref '#{a b c})

15:57 clojurebot: #<Ref@bc7c0: #{a c b}>

15:58 durka42: cool

15:59 Chouser: ,(let [a (atom 4)] (swap! a inc) (prn a) (swap! a + 10) (prn a))

15:59 clojurebot: #<Atom@ab58d: 5> #<Atom@ab58d: 15>

16:00 hiredman: clojurebot: emotion is <reply>this model does not support emotionml as spec'd in http://www.w3.org/2005/Incubator/emotion/XGR-emotionml-20081120/

16:00 clojurebot: c'est bon!

16:01 dreish: Wow, now I know the XML for a relaxed, positive state with a feeling of being in control of the situation.

16:02 Can we use that to fix the economy somehow?

16:06 hiredman: man

16:06 this spec is awesome

16:06 <intrinsic-pleasantness value="-0.5"/>

16:19 _knapr_: hmm im writing an mp3player using swing and miglayout and im actually starting to question doing it in Clojure. While it is a lot less verbose it seems it is so Java-interopable it doesnt make much sense to not use Java. And Java tels you when you arent catching somehting you should...

16:21 eyeris: The JSON is the only contents of that file.

16:21 erm, wrong channel

16:21 Chouser: If you prefer more verbose code and checked exceptions, it's quite likely you'll prefer Java over Clojure.

16:23 _knapr_: i dont prefer verbose code(as i read) but whats the advantage of not having checked exceptions?

16:24 hiredman: not having to boiler plate (try (catch)) everywhere

16:26 Chouser: here's one opinion on the matter: http://www.mindview.net/Etc/Discussions/CheckedExceptions

16:34 _knapr_: so it means your app crashes instead...

16:34 hiredman: only if you don't handle the exception

16:35 actually clojurebot was throwing exceptions almost constantly, but kept working and I never noticed till I added a try catch block in somewhere

16:35 I not have a nil case for its main multimethod

16:35 I did not

16:35 whidden: Has anyone been able to update their win32 clojure-box to the lasted clojure and clojure-contrib?

16:36 Chouser: but java still has some unchecked exceptions, so your app could still crash even if it compiles ok

16:36 _knapr_: sure

16:36 hiredman: yes but you handle them by try catching right?

16:37 * durka42 calls this bad library design

16:37 _knapr_: or a lot ifs instead?

16:37 durka42: to prevent an ExceptionInInitializerException, you apparently have to import one class and call a static method on it, before importing another (related) class

16:37 _knapr_: * what is durka referring to?

16:37 durka42: QTJava

16:41 BigTom: Hi, Ok. So, as advised, I am working through SICP (another + to Clojure, its motivated me to dig in to it). Haven't got to combinators yet but have a question.

16:43 re, Recursion and Iteration, there is recursive functions that process recursively, and recursive functions that process iteratively. Is that right?

16:43 ayrnieu: yes, in SICP's terminology.

16:44 BigTom: and recur is Clojure's way of doing iterative recursive functions (in SICP speak)

16:44 ayrnieu: yes.

16:44 BigTom: and is Ackermann's function a complete mind f**k, or is that just me?

16:45 Hun: it is.

16:45 BigTom: phew :-)

16:45 Hun: n is more or less the degree of your function

16:45 err

16:45 m

16:46 0, 1, 2 => O(n)

16:46 3 => expt(n)

16:46 and so on. think of knuth's arrow notation

16:46 the extended one.

16:47 BigTom: ah, and I was doing so well...

16:47 I am having a late life comp sci education

16:47 well, better late than never

16:47 Hun: don't let that demotivate you. ackermann is not very practical :)

16:48 BigTom: I am just going to leap over it to Tree Recursion

16:48 Hun: yep. that part is nice

16:48 _knapr_: so basically it could be good if instead of forcing to check exceptions, they should generate warnings

16:48 you dont have to catch them but you are told which you arent

16:48 shoover``: whidden: XP or Vista?

16:51 BigTom: Cool, oh well, only another 300 pages or so to get to Streams

16:51 hiredman: clojurebot: checked exceptions?

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

16:51 Hun: there's a lot of great stuff in these pages, BigTom

16:51 hiredman: clojurebot: checked exceptions is <reply>http://www.mindview.net/Etc/Discussions/CheckedExceptions

16:51 clojurebot: Ik begrijp

16:51 BigTom: Hun: thanks for the pointers.

16:55 Hun: Inspirating: http://fs6.depauw.edu:50080/~dharms/pdp11/

16:58 BigTom: pdp11?

16:58 Hun: yep. very old computer

16:59 was the machine the original unix was written on

16:59 BigTom: I know, very old, my Dad used to collate his marks on one

16:59 He was an agile client for the computer Dept in the 70's

17:00 they kept overreaching themselves

17:00 Hun: i finished a course in hardware design last week. one concept that most people had a problem with was bootstrapping the machine. i think it would have helped to have watched how the pdp was programmed

17:02 i cheated a bit. as my first program was aligned to address 0x100 and the reset set the cpu to 0x00, i patched the corresponding code directly into the binary with a hex editor

17:03 to the amazement of my professor. afterwards he made me aware that i could just have opened a new section in the assembler, aligned to 0

17:03 BigTom: That's not cheating

17:03 _knapr_: you dont have to catch them but you are told which you arent

17:03 hiredman: sounds like a fun class

17:03 Hun: hiredman: it was great

17:03 _knapr_: so basically it could be good if instead of forcing to check exceptions, they should generate warnings, you dont have to catch them but you are told which you arent

17:03 Hun: first we implemented a small cpu (16 bit address, data, 16 opcodes, 8 registers)

17:04 BigTom: I used to patch code in main memory by branching to some unused memory at the end of a code block, put in th efix and branch back to after the bug

17:04 Hun: afterwards each team added some cool stuff (like a pipeline, a vga port, some software, ...)

17:04 we built a single precision fpu :)

17:04 hiredman: wow

17:04 Hun: i won't use floating point math from now on. that stuff is evil

17:05 i used lisp (CL, not clojure. sorry ;) for validating everything

17:05 as we used ieee754 format for everything, i could just calculate on my main pc and compare results to find bugs

17:06 i used randomized numbers for just about anything, so that i could fuzz failures out

17:06 there was just one problem: with the integer math, everything worked out fine. but the floating point stuff were effectively just nops

17:07 so (+ float1 float2) == (max float1 float2)

17:07 because the values were so different that after all that shifting stuff, the smaller one was usually completely absorbed by the larger one

17:07 took me 2 hours to understand that `bug'

17:08 hiredman: heh

17:08 Hun: then i had to derandomize my random numbers to build proper tests

17:08 random numbers are hard

17:09 BigTom: Hun: makes me wish I could go back to uni

17:09 ah well

17:09 gotta go

17:09 Hun: :)

17:12 _knapr_: if i have a song playing, can i do, hwne (when (.isComplete player) dosomething)? like can it be event driven?

17:15 durka42: you could start a thread polling .isComplete

17:16 walters: _knapr_: there's some event/signal stuff in java.beans. i'm not a big fan of it personally, but it's going to better than burning the CPU polling

17:18 Hun: polling is not necessarily bad, though it is in this case

17:18 done properly, it has hardly any impact on the performance

17:18 walters: from the POV of an individual program maybe

17:19 but if many program authors do it, it really does add up

17:19 a modern processor drains far less power in full sleep

17:19 Hun: true

17:20 though it wakes up a lot by the OS itself already

17:20 walters: it == the JVM?

17:20 hiredman: _knapr_: you should check the java doc of the lib you ar using for some kind if isCompleteListener you can register

17:20 _knapr_: so what is the normal thing to do?

17:20 Hun: walters: the cpu

17:20 walters: Hun: modern Linux kernels are tickless

17:21 Hun: on big computers maybe. my avr32 doesn't have that luxus, and that's where saving power really works :)

17:22 hiredman: walters: the timers maybe tickless, but there is a heck of a lot of other code on a machine running a "modern" linux kernel, that may or may not be tickless

17:23 _knapr_: it has no listener just a is.Complete.

17:23 isComplete

17:23 walters: hiredman: of course, but broadly speaking the applications are the problem nowadays, not the OS

17:23 Hun: yep

17:24 hiredman: _knapr_: then you are stuck polling

17:25 whidden: shoover: sorry for the delay... meetings and all.. xp, what's vista ? ;)

17:26 durka42: oh dear

17:26 JVM bus error

17:26 shoover``: whidden: I haven't updated Clojure Box because it hangs spawning the REPL on XP until I press enter. Can't figure it out

17:26 _knapr_: ok but i dont really get how to poll, from the main event dispatch thread in swing? how do I get a hold of that?

17:27 like in my app i dont have a giant-global-controlling-everything-thingie which can poll, notify, command etc

17:28 walters: well, swing has something like that underneath, but i don't know if it has any API explicitly for it

17:28 hiredman: _knapr_: you just make a thread that loops and checks isComplete and fires some function when it is true

17:28 Hun: you could just use an extra timeout-thread for the polling (which is ugly but should work)

17:28 whidden: shoover: hmmm the generic works out fine.. when i update swank has issues.

17:29 i'm going through the swank code looking for diffs right now.

17:29 shoover``: whidden: updated slime from cvs as well?

17:30 whidden: shoover: haven't done that yet. Looked at changelog of cvs slime and didn't see anything that look crucial.. might have missed something though.

17:31 shoover``: it's all crucial. the two projects get out of sync easily

17:33 whidden: Shoover: argh... i know that/this feeling..

17:35 shoover``: I'll publish a new Clojure Box as soon as I can get the REPL to pop up automatically again, but I don't know when that will be

17:39 whidden: Shoover: ok.. i've updated just the slime to latest and now repl connects but slime does not connect to the back end.

17:39 shoover``: errors, or just nothing?

17:40 whidden: yes errors

17:40 shoover``: quagmire

17:40 whidden: how do i use pastebot?

17:40 shoover``: lisppaste8: url

17:40 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

17:42 whidden pasted "clojure-box startup" at http://paste.lisp.org/display/74457

17:43 whidden: shoover: that's what i have with updated slime from cvs head, and from clojure head.

17:44 hiredman: what is on line 261 of basic.clj?

17:45 whidden: hiredman: that line is (map #(.getPath #^java.net.URL %) (.getURLs clojure.lang.RT/ROOT_CLASSLOADER))))

17:46 _knapr_: thing is i dont get exactly how threading works. how do ir efer toa function operating in a thread?

17:46 lisppaste8: whidden annotated #74457 with "function that errors" at http://paste.lisp.org/display/74457#1

17:47 hiredman: ,clojure.lang.RT/ROOT_CLASSLOADER

17:47 clojurebot: java.lang.Exception: No such namespace: clojure.lang.RT

17:47 whidden: hiredman: clojure.lang.RT moved?

17:48 hiredman: dunno

17:48 I have not looked at the java source stuff in about three months

17:49 Chouser: no, ROOT_CLASSLOADER is gone or private

17:49 whidden: :(

17:49 Chouser: try (clojure.lang.RT/baseLoader)

17:49 hiredman: yeah

17:49 private now

17:50 Chouser: note the parens where there weren't any before.

17:50 hiredman: ,(clojure.lang.RT/baseLoader)

17:50 clojurebot: #<DynamicClassLoader clojure.lang.DynamicClassLoader@1b3f8f6>

17:50 shoover``: also, if you're using latest slime you also must use latest swank-clojure from github

17:50 which by the way fixes the classloader change

17:51 whidden: lol... i'm realizing that.

17:53 lisppaste8: whidden annotated #74457 with "latest swank-clojure" at http://paste.lisp.org/display/74457#2

17:53 whidden: no errors, but slime not really happy yet.

17:53 shoover``: ok, then it's not just me. that's why I haven't pushed a new Clojure Box yet

17:53 just press Enter

17:53 hiredman: eww iso-latin?

17:54 is that an encoding? shame on you for not using utf-8

17:54 whidden: well slime not really there.. its passing strings down to repl and all but no tab completion, or understanding of clojure.

17:54 shoover``: oh yeah, there's one missing piece

17:54 whidden: ?

17:55 * whidden looks on the floor for the missing piece.

17:55 * whidden is thinking that the cats ate it.

17:56 shoover``: you need this in emacs/site-lisp/site-start.el, inside the swank-clojure-config call: (slime-setup '(slime-repl))

17:56

17:58 _knapr_: i dont understand how to create a thread queries another thread

17:58 whidden: i have not swank-clojure stuff in that file.

17:59 lisppaste8: whidden annotated #74457 with "site-start.el" at http://paste.lisp.org/display/74457#3

17:59 shoover``: hiredman: slime passes that encoding to the swank-clojure world somehow. I'm not sure what determines it

17:59 hiredman: ,(let [a (ref :b)] (.start (Thread. #(prinln a))))

17:59 clojurebot: java.lang.Exception: Unable to resolve symbol: prinln in this context

17:59 hiredman: ,(let [a (ref :b)] (.start (Thread. #(println a))))

17:59 clojurebot: nil

17:59 hiredman: hmmm

18:00 ,(let [a (ref :b)] (.start (Thread. #(binding [*out* *out*] (println a)))))

18:00 clojurebot: nil

18:01 hiredman: anyway

18:01 whidden: _knapr_: what do you mean by query?

18:01 hiredman: something like that

18:01 shoover``: whidden: is there a default.el?

18:01 whidden: yeppers

18:01 shoover``: ok. gotta go. good luck

18:02 whidden: gee and a config :)

18:02 _knapr_: whidden: i need to query if a a taks is finished

18:02 and all this has to run besides the main event thread

18:03 whidden: Shoover: thanks.. works

18:03 hiredman: _knapr_: you can make and start a new thread by passing a function of no args to Thread.

18:03 then you call .start on the new thread to start it

18:04 I am pretty sure you did all this yesterday

18:04 lisppaste8: url

18:04 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

18:08 _knapr_: hiredman: yes

18:09 but i dont quite get communicztion between threads

18:09 how do iq uery a thread, if it constantly runs function x, that returns a bool

18:09 scottj: Isn't there a better way to write (if foo foo bar) that doesn't require repeating foo?

18:09 _knapr_: can i hen do: (if thread-x ...)?

18:09 hiredman: scottj: if-let?

18:09 ,(doc if-let)

18:09 clojurebot: "([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"

18:10 hiredman: oh

18:10 no

18:10 not if-let

18:10 ,(or :a :b)

18:10 clojurebot: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Keyword

18:10 Chouser: (or foo bar)

18:10 hiredman: uh

18:10 weird

18:11 scottj: thanks

18:16 hiredman: ,(or :a :b)

18:16 clojurebot: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Keyword

18:19 _knapr_: it just seems to go into infinite recursion. if i start a thread that polls then i need a thread that checks when the poll is complete and then a thread that has checked that etc

18:22 hiredman: _knapr_: you put an if in the thread that polls, and if isComplete it some function, or toggles some flag, or something

18:22 jesus

18:24 Chouser: hiredman: please keep the more colorful elements of your comments to yourself, if you don't mind. The rest are quite welcome.

18:24 ayrnieu: belatedly, Clojure For Erlang Programmers, part 1: "Clojure doesn't have what you will regard as meaningful support for concurrency." (Working on part 2.)

18:35 hiredman: Chouser: sorry

18:35 bitbckt: hiredman: you're fired.

18:50 achim_p: hi all! i've got a question about gen-class (chances are that it's a stupid one ...)

18:50 is there a way to call methods on "this" from within the :init function?

18:51 i'd like to replicate sth like this (-> paste)

18:51 lisppaste8: achim_p pasted "gen-class counterpart?" at http://paste.lisp.org/display/74463

19:01 clojurebot: svn rev 1236; branch for trying fully-lazy sequences

19:01 svn rev 1237; [lazy] added Seqable

19:01 svn rev 1238; [lazy] added closed-over local tail clearing, for once-only fns, used in delay

19:24 hiredman: hmmm

19:36 Chouser: achim_p: http://code.google.com/p/clojure/issues/detail?id=45

20:13 lisppaste8: knapr pasted "threadache" at http://paste.lisp.org/display/74469

20:14 knapr: anyone good with swing+threads? have a look there plz

20:17 Chouser: yeah, you might want some (Thread/sleep 500) or something in your poll-thread fn

20:17 I bet that pegs your CPU when it's playing.

20:18 Using 'def' as you do in play-next is discouraged. You should use a Ref for playlist.

20:20 You might try printing out the arg you send to utils/play-mp3 to make sure it's what you want.

20:20 If it is, then your problem is mostly likely in progs.mp3play.utils, which doesn't appear to be pasted there.

20:21 lisppaste8: knapr annotated #74469 with "untitled" at http://paste.lisp.org/display/74469#1

20:21 Chousuke: eventually you might want to remove that polling completely and instead have the player send a "finished" signal or callback whenever playback is complete.

20:21 knapr: now it is, dont think that is the problem

20:21 yes but to what should it send that?

20:21 and how do I add such a thing to the player?

20:23 Chousuke: knapr: also, (when (not= player nil)) == (when player)

20:23 unless player can be false, but in this case it probably won't be :)

20:23 knapr: the thread sleep is that something i ahv to tell it several times or it is an attribute I kind of add to it so sleeps for x ms very what?

20:24 Chousuke: it's a method.

20:25 ,(.run (Thread. #(do (Thread/sleep 1000) (println "Done sleeping"))))

20:25 clojurebot: Done sleeping

20:25 Chousuke: like that

20:26 (well, it's probably not visible unless you have timestamps, but there was a pause before clojurebot replied)

20:29 knapr: yeah i see it but it still stops the music, i have 5000 sleep

20:32 Chousuke: wait, in which thread are you sleeping?

20:32 knapr: are you sleeping in the polling thread?

20:33 knapr: yes

20:33 thats whats weird

20:33 lisppaste8: knapr annotated #74469 with "untitled" at http://paste.lisp.org/display/74469#2

20:34 Chousuke: knapr: you can't do it like that.

20:35 knapr: your song-finished? function has the loop so the thread/sleep is never even executed because the "infinite" loop does not terminate

20:36 knapr: ah

20:36 ofc

20:37 i need to resdesign the whole function then

20:37 lisppaste8: Chousuke annotated #74469 with "this" at http://paste.lisp.org/display/74469#3

20:38 Chousuke: but polling is inefficient and inaccurate anyway; the best solution would be to have the player tell you when it's done.

20:38 but I guess that'll do just fine as a preliminary solution :)

20:41 knapr: yes thats what i want, do i have to implement some kind of ActionListener for that?

20:42 Chousuke: I don't know how your player works.

20:42 knapr: thats what i thought firts but how does it now what thread to sleep in? is the functon aware of what thread it is in? i thought only the thread knew what functions it had in it

20:42 Chousuke: the JVM knows which thread it is running

20:43 knapr: ok

20:43 i see

20:43 nice now it works, at least that part :)

20:43 Chousuke: good.

20:43 now I'll get some sleep.

20:44 later

20:51 knapr: woot it actually works completely

21:05 is there a way to loop over a java list?

21:06 durka42: map doesn't work?

21:13 hiredman: knapr: well, to actually "loop" you would use (loop [] (recur))

21:14 but most likely you could use map, or doseq, or something else

21:17 arohner: is there a function in core to turn the output of map into a hash? I know I can do (into {} (map #(..)), but that seems too verbose

21:19 I want a 'map-hash', where the return value of your map fn has to return key-value pairs

21:20 durka42: hash-map :)

21:21 (doc hash-map)

21:21 clojurebot: keyval => key val Returns a new hash map with supplied mappings.; arglists ([] [& keyvals])

21:22 dreish: Probably (defn map-hash [f & seqs] (into {} (apply map f seqs))) would work, I guess.

21:22 hiredman: ,(let [map-hash (comp (partial apply hash-map) mapcat)] (map-hash identity {:a 1 :b 2}))

21:22 clojurebot: {:a 1, :b 2}

21:23 hiredman: (comp (partial apply hash-map) mapcat)

21:33 knapr: how do i catch multiple exceptions?

21:35 gnuvince_: knapr: multiple catches

21:36 (try (catch Exception e ...) (catch AnotherException e ...))

21:47 durka42: woo! that took long enough

21:47 clojure has eyes

21:48 and by that i mean an iSight camera

21:48 it only took 140 lines, directly ported from java

21:49 knapr: how long was the java code?

21:49 lisppaste8: knapr annotated #74469 with "untitled" at http://paste.lisp.org/display/74469#4

21:50 knapr: anyone could chec that? why is that consuming the main thread when i start a new thread with low priority?

21:50 durka42: java was 205

21:50 clojure is 120 or so once i take out all the (prn "i'm still alive!")

21:50 knapr: lol

21:51 durka42: i kept moving that down line by line until i found the exceptions

21:51 debugging technique: replace any value with (do (prn "not dead yet") value)

21:57 ozy`: hmm, scala's on the shootout... quick, someone submit clojure programs :p

21:57 http://shootout.alioth.debian.org <== c'mon, everybody's doing it...

22:06 durka42: should i put up this mess of QT code on pastebin?

22:06 Raynes: I didn't know Scala was on the shootout.

22:06 I was looking for it yesterday, didn't look hard enough.

22:07 durka42: it's almost entirely a 70-line let statement

22:09 Chouser: durka42: blog it!

22:10 durka42: that would require me to have a blog

22:10 i could start one

22:10 Chouser: you sure could

22:10 or second best, post it to the google group.

22:10 either way will be more searchable than here, probably.

22:10 durka42: this entry titled, adventures in what happens when you try to port a mess of imperative java code to clojure

22:13 hmm i could try to use github-pages

22:17 Chouser: durka42: wow, that looks nice.

22:19 durka42: Chouser: http://github.com/blog/272-github-pages

22:20 Chouser: yep, that's what I was reacting to.

22:21 arohner: durka42: thanks

22:22 pjb3: Is it possible to generate a named class at runtime?

22:25 Chouser: yes, but not in any clean supported way that I can think of.

22:25 it used to be possible, but it tended to cause problems.

22:39 pjb3: So I'm trying to generate the most basic class possible

22:39 I created a file in a directory ex call foo.clj

22:40 All it has in it is: (ns ex.Foo (:gen-class))

22:40 Then I start clojure in the directory that contains ex with: java -cp .:/clojure.jar clojure.lang.Repl

22:40 user=> (compile 'ex.foo)

22:40 java.io.IOException: No such file or directory (foo.clj:1)

22:42 Chouser: pjb3: what's your *compile-path* ?

22:43 ,(prn *compile-path*)

22:43 clojurebot: nil

22:43 pjb3: I think moving into a sub-directory fixed it, hold on

22:45 (prn *compile-path*) is "classes"

22:45 Chouser: you need that in your classpath

22:45 pjb3: I suppose that means it expects to have a directory relative to the current directory called classes to put the compiled files into?

22:46 Chouser: java -cp .:/clojure.jar:classes clojure.lang.Repl

22:46 pjb3: Chouser: yeah that does it, thanks

22:48 durka42: clojurebot: logs?

22:48 clojurebot: logs is http://clojure-log.n01se.net/

22:48 durka42: Chouser: is it down?

22:49 can one implement a constructor using proxy?

22:50 Chouser: durka42: it does appear to be down.

22:57 knapr: http://paste.lisp.org/display/74469#4 , can anyone tell me why play-playlist consumes the main event dispatch thread? becuase i start a new thread so it shouldnt

22:59 hiredman: (play-next playlist) should be #(play-next playlist)

23:00 you ned to pass a function to Thread.

23:00 #(play-next playlist) is short for (fn [] (play-next playlist))

23:02 knapr: ah ofc that again

23:02 u told me yesterday

23:02 great now it works!

23:02 no it is just polishing hte thing that is left

23:07 Chouser: durka42: log's back

23:09 danlarkin: looking through contrib... it has grown a lot in the past month

23:11 *gasp* there's json code in contrib :(

23:14 Chouser: danlarkin: perhaps he didn't know about your lib. Have you announced it on the google group?

23:14 danlarkin: Chouser: no, never got around to that

23:15 Chouser: You should.

23:15 * danlarkin keeps thinking every hangs out in IRC every day

23:15 Chouser: :-)

23:15 danlarkin: every one

23:17 yeahh maybe I should

23:21 hiredman: ,(doc slurp)

23:21 clojurebot: "([f]); Reads the file named by f into a string and returns it."

23:24 danlarkin: mmmmm Chouser do it for me, I don't wanna :-/

23:24 Chouser: announce your lib!?

23:24 danlarkin: hahah

23:24 yeah why not

23:25 Chouser: I post too much there already.

23:25 danlarkin: You're better with prose than I

23:25 durka42: sweet

23:25 laser-pointer tracking enabled

23:26 knapr: what is the bets way to use BufferedReader?

23:26 like i want to read each lne and for each lien do something

23:26 durka42: line-seq

23:26 hiredman: knapr: slurp will read a file into a string

23:28 pjb3: Ack! http://clojure.org down!

23:29 lisppaste8: knapr pasted "hmm?" at http://paste.lisp.org/display/74474

23:29 knapr: whats up with that? i get it when i start the repl

23:31 Chouser: knapr: rebuilt clojure.jar recently?

23:31 I'd clean and rebuild

23:33 knapr: but what does the error mean?

23:33 cp2: corrupt classfile

23:34 Chouser: I think it means "clean and rebuild your clojure.jar". But that's just a guess.

23:35 durka42: ah, the old PleaseTryThatAgainException

23:39 danlarkin: heh, I'll tell ya... code reloading is tricky to get right

23:39 gotta use those (defonce)s right!

23:42 hiredman: overheard in #java:

23:42 javabot : phix, 'Some people, when confronted with a problem, think "I know, I'll use date!" Now they have two problems.'

23:42 danlarkin: haha

23:42 knapr: so

23:42 pjb3: When talking about macros you talk about expansion time and compile time

23:42 knapr: i never built it in the first place

23:42 pjb3: and I get the idea of expansion time

23:43 but what is compile time, is that different than evaluation?

23:43 For example, does the expression (+ 1 2) get compiled?

23:44 hiredman: clojure has a sameworld compiler so compilation and evaluation is the same

23:44 oh

23:44 well

23:44 Yes

23:44 pjb3: So (+ 1 2) doesn't just get evaluated? It gets compiled, then evaluated?

23:44 What does it get compiled into?

23:44 hiredman: jvm butecode

23:45 bytecode

23:46 pjb3: Really? Every time I do (+ 1 2), bytecode compilation happens?

23:46 hiredman: from my understanding, yes

23:46 although

23:46 no

23:46 wait

23:46 well

23:46 yes

23:46 a very little does

23:47 + is already compiled

23:48 2009:Jan:07:17:27:08 rhickey pjb3: that is not going to happen, at least not without a cert - Clojure is not interpreted and the default security prohibits custom classloaders needed for eval

23:49 pjb3: ok, eval I get

23:49 hiredman: emphasis on the "Clojure is not interpreted" bit

23:50 pjb3: Right, so my assumption was that the functions get compiled to bytecode, but once that happens, you can just eval them

23:51 so bytecode compilation has to occur when you do (defn f [x] (* x x))

23:51 but then when you do (f 3), it's the same thing as calling a method in java

23:52 hiredman: Huh

23:52 pjb3: I suppose you still need to turn (f 3) into the java data strucutres

23:52 hiredman: but a method call to java is bytecode

23:52 java is also compiled and run

23:52 whidden: if I might chime in. I think the REPL might be getting in the way of clarification.

23:53 pjb3: whidden: please do :)

23:53 whidden: my take and understanding, is this.

23:53 the function (defn f[x] (* x x)) is taken in either at REPL or load-file

23:54 and compiled into jvm byte code

23:54 from REPL the invokation of said function f is

23:54 made as a method call

23:55 ala the jvm mechanisms

23:55 hiredman: but a method call is jvm bytecode

23:55 whidden: for the REPL probably

23:55 s/for/from/

23:56 but the hotspot compiler will have a chance to work on the method if it sees a lot of activity.

23:56 hiredman: whidden: are you saying it isn't if you aren't using the repl?

23:56 whidden: the optimizer vanishing awya your code is a whole nother mater

23:56 whidden: if you arn't using REPL then you are working with only byte code, as that' what the clojure compiler produces.

23:57 hiredman: even at the repl you must be using bytecode

23:57 because that is all there is

23:57 whidden: with REPL you are going through a lot of invoke and method ... <name escapes me right now>

23:57 hiredman: java does not run "on top" of the bytecode somewhere, so you can reach up and call it

23:58 whidden: i.e. a lot of method look ups

23:58 right

23:58 its really jvm

23:58 hiredman: so the only way to interact with java or the jvm is through bytecode

23:59 it just happens to be the byte code for invoke and method what have you

23:59 whidden: and with the helping hand of REPL, which provides convience methods for doing just that.

23:59 durka42: namely eval

Logging service provided by n01se.net