#clojure logs

2009-01-28

00:00hiredmanknapr: use macroexpand-1 and macroexpand
00:00hiredmanexamine the code your macro generates for errors
00:04knaprlooks correct...
00:07knaprbut problem is the function seems to be evaled when it shouldnt be
00:07knapr(. play-button
00:08knaprhow can that be rewrittwn?
00:09knapris
00:09knapr(. play-button
00:09knapr (addActionListener
00:09knapr (.addActionListener play-button ?
00:27durka42is java instanceof => clojure isa?
00:28durka42or is it instance?
00:28Cark,(doc instance?)
00:28clojurebot"([c x]); Evaluates x and tests if it is an instance of the class c. Returns true or false"
00:28Carkvould be this one
00:28Carkcould
00:34danlarkinisa? should be used for derivations I believe
00:34danlarkininstance? is for java classes
00:37hiredman,(doc isa?)
00:37clojurebot"([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"
00:37hiredman,(isa? String Object)
00:37clojurebottrue
00:38hiredman,(isa? "" Object)
00:38clojurebotfalse
00:41hiredman,(identical? "" "")
00:41clojurebottrue
00:49durka42(instance? "" String)
00:49durka42,(instance? "" String)
00:49clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Class
00:49durka42,(instance? String "")
00:49clojurebottrue
00:49durka42,(instance? Object "")
00:49clojurebottrue
00:54durka42is try/catch allowed inside catch?
01:14durka42QTJava doesn't work on Java 6...that is very unfortunate
01:15hiredmanquicktime java?
01:15durka42yes
01:15durka42QTJava is a wrapper around a 32 bit library
01:16durka42java 6 mac is 64 bit only
01:16durka42ergo, no quicktime
01:16hiredmanyou could build your own 32bit jdk
01:17durka42it went from an UnsatisfiedLinkError to an ExceptionInitializerError: Quicktime must be initialized
01:17durka42now that i can deal with
01:17durka42hiredman: i'm not sure that's the issue
01:17durka42i don't think you can have java 6, 32 bit, on a mac
01:18hiredmanif you built one, I think you can
01:19durka42hmm
01:19durka42possibly
01:19durka42http://paranoid-engineering.blogspot.com/2008/09/java-6-on-32-bit-intel-mac.html
01:19durka42i don't know if it's worth it, since i can just run this program on java 5
01:20hiredmanhttp://landonf.bikemonkey.org/code/macosx/FreeBSD_Java_16_Status_Update.20071112.html
01:22durka42tell me that isn't runescape
01:22hiredmanI dunno
01:23hiredmandon't recognize it
01:33timothypratleyHi Christophe, thanks for your reply on the group re: zipping... I wonder if you could help with some follow up questions! :)
01:33timothypratleysay I wanted to construct ((1)) or (2 (1)), starting with 1, then adding a parent
01:38hiredmanyou cannot add parents
01:39hiredmanyou can take something and add it as a child to a new parent
01:41hiredman,(-> '() zip/vector-seq (zip/insert-child 1) zip/root)
01:41clojurebotjava.lang.Exception: No such var: zip/vector-seq
01:41hiredman,(-> '() zip/seq-zip (zip/insert-child 1) zip/root)
01:41clojurebot(1)
01:42hiredman,(-> '() zip/seq-zip (zip/insert-child 2) (zip/insert-child (-> '() zip/seq-zip (zip/insert-child 1) zip/root)))
01:42clojurebot[((1) 2) {:changed? true}]
01:42hiredman,(-> '() zip/seq-zip (zip/insert-child 2) (zip/insert-child (-> '() zip/seq-zip (zip/insert-child 1) zip/root)) zip/root)
01:42clojurebot((1) 2)
01:42hiredman,(-> '() zip/seq-zip (zip/insert-child 2) (zip/append-child (-> '() zip/seq-zip (zip/insert-child 1) zip/root)) zip/root)
01:42clojurebot(2 (1))
01:45timothypratleyah neat, thanks hm!
02:00hiredman,(doc zip/zipper)
02:00clojurebot"([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."
03:19zakwilsonReading 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.
03:26cadscommas are whitespaces in clojure?
03:26ayrnieuyes.
03:27cadsdon't know why that makes me so happy
03:27cadsbut it does :D
03:27hiredmanit is pretty great
03:27hiredman,[,]
03:27hiredmanhmm
03:27hiredmanclojurebot: hello?
03:27clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline hiredman
03:27hiredmanoh
03:28hiredman<-- retard
03:28ayrnieu,[({1 2 3 4} 1), ({1 2, 3 4} 3)]
03:28hiredmanneeds parens
03:28ayrnieu,(list ({1 2 3 4} 1), ({1 2, 3 4} 3))
03:28clojurebot(2 4)
03:28hiredmanI should fix that
03:29ayrnieu,(list 1,000 1'000)
03:29clojurebot(1 0 1 0)
03:29hiredmanthat is weird
03:29cadswow that is neat though
03:30ayrnieu1'000 is pretty weird, yes. It'd be nice if that evaluated to 1000
03:30ayrnieu,(class '1)
03:30clojurebotjava.lang.Integer
03:30hiredmanhuh
03:30cadsehh, at least it doesn't evaluate to a half open string..
03:30ayrnieu(quote 1) is just 1. I guess that's actually not too weird.
03:30cadsoh wait
03:30ayrnieua half open string?
03:31ayrnieu-- ah.
03:31ayrnieuwell, clojure can give you that in other ways :-)
03:32cads'astring' is a string in which escaped sequences are printed character for character
03:32cadsI forgot the semantics of ' in lisps
03:33hiredman,[1]
03:33clojurebot[1]
03:33cadsbtw the Clojure for Lisp Programmers talk is pretty damn informative, even for this programmer who's only studied a little lisp
03:33hiredman,{:a}
03:33clojurebotjava.lang.ArrayIndexOutOfBoundsException: 1
03:35cads{:a 1 :steak "sauce"}
03:35cadshrm, does it need a comma in front for clojurebot to evaluate?
03:35cads(list 1 2 3 4 5 6)
03:35ayrnieuyes.
03:36cads,(list 2 3 4)
03:36clojurebot(2 3 4)
03:36cads,{:a 1 :steak "sauce"}
03:36clojurebot{:a 1, :steak "sauce"}
03:36cads,'(2 3 4)
03:36clojurebot(2 3 4)
03:36cads,(2 3 4)
03:36clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
03:36cadsyay
03:38cadshiredman: your clojurebot on github, is he the same guy as in the channel?
03:38hiredmanyes
03:39cadsI always feel like asking permission to use code like this, even when it's open :)
03:40cadsI wonder if clojurebot and lambdabot will be friends on my system?
03:40hiredmanclojurebot: paste
03:40clojurebotlisppaste8, url
03:40lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
03:40hiredmanit does play well with others :P
03:41hiredmanlambdabot uses '>' and '@' yes?
03:41cadsyes
03:42hiredmancb uses neither of those
03:44cadswhy do people say that java and the JVM are doomed?
03:44ayrnieuclojurebot: 2d10
03:44clojurebotNo entiendo
03:44hiredman2d10
03:44clojurebot6
03:45cads20d100
03:45clojurebot1131
03:45cads20d100
03:45clojurebot873
03:45cads: )
03:45ayrnieuI don't know, cads, but I know that clojure has seriously rehabilitated Java for me.
03:46hiredman~google the jvm is doomed
03:46clojurebotFirst, out of 2170 results is:
03:46clojurebotJava is Doomed!
03:46clojurebothttp://www.theserverside.com/news/thread.tss?thread_id=46706
03:47cadsto 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
03:47ayrnieuChouser'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.
03:48hiredmanI don't think it is Chouser's book
03:49ayrnieuand the picture is that you not only get all these libraries, but they're pretty comfortablely used.
03:49ayrnieuah, OK.
03:49hiredmancb sits on a pircbot
03:49ayrnieu(def mkdir-task (org.apache.tools.ant.taskdefs.Mkdir.))
03:49ayrnieu... didn't mean to put a newline there.
03:50ayrnieu(map #(.getName %) (.getMethods (class mkdir-task))) <-- the next part. This feels like Ruby, not a famously onerous language.
03:51hiredmanit's weird, I did some java in school, but was never exposed to it's dynamic reflective facilities
03:51ayrnieu,(map #(symbol (.getName %)) (.getMethods java.io.File))
03:51clojurebot(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
03:53cadsyeah, the reflective style, in ruby, allows one to do some pretty magical things
03:55cadsI don't know if java allows you to create a class during runtime by analyzing other classes and splicing them together selectively
03:55cadsbut I bet the jvm doesn't mind
03:55ayrnieuit's called 'proxy' in clojure.
03:55hiredmanthere is some java asm lib that clojure uses
03:55hiredmanasm meaning jvm bytecode
03:56cads:)
03:56ayrnieu(.start (Thread. (proxy [Runnable] [] (run [] (println "I ran!")))))
03:56hiredmanayrnieu: clojure fn's are runnable
03:56ayrnieuright, that's just to show proxy off.
03:56zakwilsonHas anybody here done image manipulation stuff with Clojure?
03:57ayrnieuI haven't, but you can ask ##java about image manipulation libraries and then just use those :-)
03:57cadsso you guys think the jvm ecosystem will be around for quite a while, even if java or sun folds?
03:58zakwilsonI'm looking at Java's API for image stuff... my first reaction is something to the effect of ARRRRGH!
03:58hiredman~google java image manipulation
03:58clojurebotFirst, out of 241000 results is:
03:58clojurebotUltimate Java Image Manipulation
03:58clojurebothttp://www.javalobby.org/articles/ultimate-image/
03:58hiredmanULTIMATE
03:59cadsthat's like, the best!
03:59ayrnieuah, I think you ARRRRGHed earlier.
03:59zakwilsonThat has better results than the "java image processing" query I used before.
03:59ayrnieu~google future of java
03:59clojurebotFirst, out of 523000 results is:
03:59clojurebotThe Future of Java - The Ponderings of a Hokie
03:59clojurebothttp://blogs.sun.com/JohnEdstrom/entry/the_future_of_java
03:59cadszakwilson: just wondering, what kind of image manipulation do you have in mind?
04:00hiredmanjava seems to be entrenched to the point where it is in the CS curriculum
04:00hiredmanwhich everyone hates, but somehow it is still there
04:00cadsI am going to be trying some graphics programming in clojure as soon as I learn my first bit
04:00zakwilsonSimple batch-filtering of folders full of images. Nothing too fancy, and I'm sure I'm reinventing a wheel here.
04:01ayrnieuwhat filtering are you doing?
04:01cadsthere have got to be decent (if not state of the art) image filtering libraries out there
04:02zakwilsonresizing, color depth reduction, converting to greyscale
04:02zakwilsonMostly things that are simple library calls
04:02cadsI like that about clojure, everything java has, it has...
04:02zakwilsonThat is, if the Java libraries were simple.
04:03zakwilsonOf course, this being Clojure, said calls will be made on the entire directory listing using pmap.
04:03cadsso used to hoping someone has ported this or that to ruby, and usually being disappointed when it comes to graphics libraries
04:03hiredmanwell
04:04zakwilsonI used to call imagemagick from Ruby for the same sort of things.
04:04hiredmanpeople like performance will their graphics :P
04:04hiredmanwith
04:07zakwilsonThis 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?
04:08zakwilsonWhat I have in mind is that this program will show how many images have been processed, incrementing every time one finishes.
04:09hiredmanI think putting the gui object in an agent would be pretty reasonable
04:09hiredman(send-off *gui* mover-bar-over 1)
04:10zakwilsonI suppose that would.
04:10cadsso 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?
04:11hiredmanthey would just queue up inline to manipulate the gui
04:11zakwilsonAgents handle the not-jaming-up internally.
04:11hiredmanagents queue up actions
04:36ayrnieu,(list *bad-forms*)
04:36clojurebotjava.lang.Exception: Unable to resolve symbol: *bad-forms* in this context
04:39hiredman,(in-ns *ns*)
04:39clojurebotjava.lang.ClassCastException: clojure.lang.Namespace cannot be cast to clojure.lang.Symbol
04:39hiredman,*ns*
04:39clojurebot#<Namespace sandbox>
04:39ayrnieuoh, I found it. Just not spamming the channel with my explorations.
04:39ayrnieu,(list hiredman.sandbox/*bad-forms*)
04:39clojurebot(#{load-string eval catch def})
04:42hiredmanIf its broken in the morning I will disable binding
04:43ayrnieu,(load-reader (-> (java.io.StringReader. "(eval '(+ 1 2))") (clojure.lang.LineNumberingPushbackReader.)))
04:43clojurebot3
04:44ayrnieusrc/clj/clojure/core.clj:load-string
05:09cadspoor sun microsystems
05:10cadsthe last year has not been kind
05:12cadsA fear I have about the idea of learning a language targeting the java platform is the feeling that it might all just disappear
05:13cadsOr turn into a dead end.
05:14cadsAnd 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
05:18ayrnieuyes, 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.
05:20ayrnieuthis 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.
05:20ayrnieushould move to.
05:20ayrnieuand the time to make this decision is... right as really brilliant technologies like clojure arise :-)
05:20cadswell I don't want to be in america when it turns into a third world country
05:21cadsjust because of how bad how fast situations like that can get
05:22cadsin a way a humble life somewhere else is better, even though I don't get reality TV.
05:22ayrnieuthoughts like that should strike you by how poorly they fit the issue.
05:22cadsthey do, you're poking all sorts of holes in my paranoia
05:25cadsah 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
05:27cadsI should stop worrying and have fun
05:29cadsthanks for responding to my admittedly uninformed fears
05:30cadsand take care all
05:30ayrnieuI'm not greatly informed -- I've been avoiding Java for a decade.
05:31ayrnieuyou should ask ##java for ideas about the future of the JVM
08:14timothypratley,(doc seq-zip)
08:14clojurebotjava.lang.Exception: Unable to resolve var: seq-zip in this context
08:14timothypratley,(doc zip/seq-zip)
08:14clojurebot"([root]); Returns a zipper for nested sequences, given a root sequence"
08:14timothypratleyIt seems odd that a 'zipper' is the return 'type'
08:15timothypratleybut all the zipper functions take a 'loc' as their input
08:16timothypratley"Returns the root loc in a zipper..." seems more acurate to me?
08:17timothypratleygoodnight all :)
08:49Holcxjo /msg clojurebot help
10:08ayrnieu,(java.security.MessageDigest/getInstance "MD5"))
10:08clojurebot#<Delegate MD5 Message Digest from SUN, <initialized> >
10:09ayrnieuah, duh, doto returns its first argument and not the value of the last form.
10:11rhickeyanyone get a demo running on Android yet? (other than the first proof-of-concept hello world)
10:12HolcxjoAny how-to document how to get even a "hello world" going?
10:13leafwHolcxjo: can't you get a REPL running on a terminal?
10:13ayrnieuhttp://github.com/Nafai77/helloandroid/
10:14Holcxjoleafw: 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:14gnuvinceGood day everyone
10:15Holcxjoayrnieu: Thanks
10:16Lau_of_DKHey gnuvince
10:25achim_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:35BigTomclojurebot: Am I properly connected?
10:35clojurebotIt's greek to me.
10:41jkantzany advice on debugging runtime exceptions?
10:41jkantzwhenever I run into one I get things like:
10:41jkantz0: clojure.lang.Compiler.eval(Compiler.java:4179)
10:41jkantzand it's always a pain to find the offending code
10:41jkantzbecause there's nothing useful in the backtrace
10:42danlarkinjkantz: I know what you mean
10:45hoeckjkantz: in slime, rethrowing the cause of the exception until you hit the "real" cause helps sometimes
10:47rhickeyclojurebot: chart?
10:47clojurebotGabh mo leithsc�al?
10:50rhickeyjkantz: you can paste a stack trace
10:50rhickeylisppaste8: url
10:50lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
11:13AWizzArdrhickey: 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:14ayrnieuwizzard - http://dotlisp.sourceforge.net/
11:14AWizzArdI am talking about Clojure.
11:14AWizzArdRich developed Clojure in the beginning on both VMs for some time.
11:15AWizzArdAnd 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:16AWizzArdC# 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:16AWizzArdAlso lots of Clojure is written in pretty portable Clojure.
11:19lisppaste8jkantz pasted "untitled" at http://paste.lisp.org/display/74421
11:22jkantzer, ignore that paste, rethrowing in slime as hoek suggested revealed a better stack trace
11:24gnuvinceAWizzArd: 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:24ayrnieubut if you want to work on his old .NET version, there's that link I pasted.
11:25AWizzArdright, 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:25AWizzArdOf course, a port would be a slightly different Clojure.
11:26cgrandAWizzard: http://clojure-log.n01se.net/date/2009-01-13.html#10:41
11:26ayrnieuhypothetically, it would take one day, and all the incestuous Java-Clojure stuff would work on .NET's JVM emulation.
11:27ayrnieuhm, incestuous is the wrong word.
11:28AWizzArdcgrand: thanks for the link. So it seems someone is already working on a port of Clojure for .NET.
11:35rhickeyAWizzArd: the .Net port is coming to clojure-contrib soon
11:35rhickeystay tuned
11:36rhickeyAWizzArd: the JVM remains a great target IMO
11:38AWizzArdI 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:38AWizzArdmaybe they'll get rid of their hardware branch
11:44rhickeyhttp://s-expressions.com/2009/01/28/startup-logbook-clojure-in-production-release-v01/
11:45danm_meh, sun has plenty of cash
11:46danlarkinrhickey: very neat
11:46danm_pretty cool
11:53MarkVolkmannI 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:54hoeckMarkVolkmann: vals
11:54MarkVolkmannThanks!
12:29scottjWhat's the easiest way to sort a vector of maps by one of the map keys?
12:29eyerisWhat is the rational behind take-while expecting true and drop-while expecting nil as opposed to false?
12:29eyerisor even true?
12:30eyerispred returning true is the most intuitive to me.
12:30ayrnieu,(sort #(compare (:a %1) (:a %2)) [{:a 1 :b 2} {:a -1 :b 3} {:a 3 :b 3}])
12:30clojurebot({:a -1, :b 3} {:a 1, :b 2} {:a 3, :b 3})
12:31eyerisIf pred returns true then you can read it as "drop-while this condition holds" or "take while this condition holds"
12:31kotarak(doc sort-by)
12:31clojurebotReturns 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:32zakwilsonI'm trying to speed up an algorithm using unchecked math and getting the opposite result. Has anybody had a similar issue?
12:33eyeriszakwilson paste the code somewhere?
12:33scottjkotarak, ayrnieu: thanks!
12:35noidieyeris, seems like the docs are just out of date
12:35noidifor drop-while
12:35noidi,(drop-while (fn [x] (< x 5)) (range 10))
12:35clojurebot(5 6 7 8 9)
12:36lisppaste8zakwilson pasted "The unchecked version is much slower" at http://paste.lisp.org/display/74424
12:36noidi(doc drop-while)
12:36clojurebotReturns a lazy seq of the items in coll starting from the first item for which (pred item) returns nil.; arglists ([pred coll])
12:36eyerisnoidi Thanks.
12:36cgrand1scottj: (sort #(compare (:key %1) (:key %2)) [{:key 2}{:key 1}])
12:36ayrnieuthat doc is correct.
12:36skoptelovclojure-dev question: can i run .clj file from IDE?
12:37eyeriszakwilson so by "the opposite" you mean that it slowed down instead of speeding up
12:37noidi,(< 6 5)
12:37clojurebotfalse
12:37eyerisrather than the result of the calculation being wrong
12:37noidi^-- not nil
12:37ozy`is it possible to perform implicit lifting in clojure? e.g. could (/ sum length) ever mean #(/ (sum %) (length %))?
12:37zakwilsonRight. The result of the calculation is the same, but the unchecked version is a couple orders of magnatude slower.
12:37ayrnieuoops. OK.
12:37cgrand1scottj: or (sort #(apply compare (map :key %&)) [{:key 2}{:key 1}])
12:38eyeriszakwilson how are you testing the running time?
12:38eyerisI just want to make sure my tests are the same.
12:38eyeris(e.g. on a different JVM)
12:39zakwilsongrey-px is called in an inner loop of another function, once per pixel in an image. I'm timing that function with (time)
12:39ayrnieuozy - conceivable; unlikely.
12:40eyeriszakwilson and px is just a 32-bit int?
12:40zakwilsonYes
12:40zakwilsonI could paste the whole file and you can test it with real images if you would prefer.
12:40eyerisNo need
12:40eyerisOne sec
12:41ozy`ayrnieu: just because there would be so little syntactic difference between that and the more explicit version?
12:42ozy`(and thus more trouble than it's worth?)
12:42ayrnieuozy - not because it's useless and troublesome, but because it has severe linguistic costs.
12:42eyeriszakwilson I do need unchecked-add though
12:43zakwilsoneyeris: What do you mean?
12:43eyeriserm, nvm
12:43eyerisTypo
12:43ozy`ayrnieu: in what sense?
12:43eyerisYou missed the e in one call. I thought maybe it was a wrapper
12:44zakwilsonOops
12:44ayrnieu((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:44zakwilsonI had a wrapper, unchecked-sum (reduce unchecked-add ...), but that was very slow as well.
12:45shoover`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:46ozy`ayrnieu: ah, indeed
12:46ayrnieuthat'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:47ozy`better to leave it to strongly typed languages, then? :p
12:47drewrHow can I test if something is an array?
12:47eyeriszakwilson I get the same results. I'm not sure why.
12:48cooldude127so is test-is the de-facto clojure testing framework?
12:48ayrnieu,(.isArray (.getClass (make-array Boolean/TYPE 10)))
12:48clojurebottrue
12:49drewrayrnieu: thanks!
12:51zakwilsoneyeris: thanks for looking at it.
12:53eyeriszakwilson Could it be that unchecked-add needs to create a Java Integer?
12:54Chouserno
12:55Chouserunchecked-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:57lisppaste8zakwilson annotated #74424 with "Fixed typo" at http://paste.lisp.org/display/74424#1
12:57ayrnieuozy - 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:58zakwilsonChouser: the version I pasted there using unchecked math is MUCH slower than the basic version.
12:58Chouserhuh.
12:58zakwilsonAnd YourKit shows is spending most of its time doing unchecked-add.
12:58rhickeyzakwilson: there is no primitive support for shifts yet
12:59technomancycooldude127: seems like it
13:03lisppaste8rhickey annotated #74424 with "faster grey-px" at http://paste.lisp.org/display/74424#2
13:04rhickeythat's about 6x faster
13:04ayrnieudrewr - (.isArray (class ...)) also works. I used .getClass following a question in ##java
13:04zakwilsonrhickey: Thanks!
13:05zakwilsonI just tested it. I'm getting about 2x faster than my original version.
13:05rhickeyzakwilson: should be 6x faster for you too, ar eyou running with -server?
13:06eyerisAre Strings collections?
13:06ayrnieu,(coll? "s")
13:06clojurebotfalse
13:06drewrayrnieu: I really need (array? ...)
13:06zakwilsonI think so. This is running inside Slime. I'm not exactly sure what the startup options are.
13:06eyerisayrnieu Thanks
13:07drewrayrnieu: I'm using a lib (net.sf.json) that thinks (array? [1 2 3]) == true
13:07rhickeyzakwilson: (time (last (map grey-px (range 1000000))))
13:07drewrso I have to do my own logic to figure out whether to use JSONObject/fromObject or JSONArray/fromObject
13:07drewrlame-o
13:08drewrabstraction leak at its worst
13:08danlarkindrewr: *ahem* http://github.com/danlarkin/clojure-json/tree/master
13:08drewrdanlarkin: never!
13:08drewr:-)
13:08danlarkinlove it!
13:10ayrnieu,(map class ["" () [] nil 1 1.0 1/2 {} #{} #""])
13:10clojurebot(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:10zakwilsonrhickey: 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:11hiredmanclojurebot uses clojure-json for googling btw
13:11danlarkin*cheer*
13:11ayrnieuhiredman, I broke clojurebot right after you left, if you didn't see
13:11kotarakOne should not rely in the specific type.
13:11kotaraks/in/on
13:11hiredmanayrnieu: still works, so it is not broken
13:12ayrnieuI mean 'broke' as in 'I can call eval, etc.' on it.
13:12hiredmanthe only reason to not allow eval is catch
13:12ayrnieuah, OK.
13:13hiredmancatch can catch the exception that Thread.stop generates
13:13hiredmanand dos cb
13:18erohtar__rhickey: thanks for clojure, we're using it in production
13:19erohtar__rhickey: i've written it up here - http://s-expressions.com/2009/01/28/startup-logbook-clojure-in-production-release-v01/
13:20erohtar__danlarkin: thanks for ur help with my clojure-json questions - we have something in production now
13:21danlarkinerohtar__: glad to hear it!
13:22rhickeyerohtar__: you're welcome!
13:32cooldude127what is the right way to signal an error from my function? should i use (assert) if it's for like a precondition?
13:33danlarkincooldude127: assertions are for preconditions yes
13:34cooldude127danlarkin: cool, but what about other errors, are we still using just java exceptions?
13:36danlarkinChouser (I think) whipped up an error smuggling library-of-sorts... I think it's on lisppaste somewhere
13:36danlarkinbut yeah I think generally we're just using java exceptions
13:37cooldude127ok
13:46zakwilsonrhickey: 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:46rhickeyzakwilson: np
13:48Chouserdanlarkin: that's for CL-condition-like features?
13:48danlarkinChouser: yessir
13:48Chouserok
13:51danlarkinit was you, right?
13:53ChouserI was kicking around some ideas, yeah.
13:54Chouseroh!
13:54ChouserI completely misunderstood what you were saying.
13:54Chouserdanlarkin: I thought you were telling me that *you* had whipped up something.
13:55danlarkinChouser: that happens to me a lot :'( oh, nono
13:55Chouserand I was thinking "that's nice, maybe I won't have to"
13:55dreishrhickey: As long as it's Thanking Hour, thanks for making the first Lisp that I find fun to use _and_ very practical.
13:56rhickeydreish: you're quite welcome!
13:57Chouserrhickey: thanks for getting me hooked into a community that now consumes all my spare time, just to keep up with the mailing list.
13:57dreishQuick 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:57rhickeyChouser: sure thing!
13:58dreishI 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:58rhickeyChouser: what's this "spare time" thing of which you speak?
13:59kotarakspare time
13:59kotaraknoun
13:59kotaraktime that is not taken up by one's usual activities; leisure time.
13:59Chouserrhickey: 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:01dreish,(gensym)
14:01clojurebotG__1528
14:01dreish,(= (gensym) 'G__1532)
14:01clojurebottrue
14:01dreishCan't do that in Common Lisp no matter how hard you try.
14:01rhickeydreish: I consider that a theoretical problem, but not a practical one
14:01dreishok
14:02rhickeydouble underscores being quite ugly
14:02drewrdanlarkin: any particular reason you use :as with :use?
14:02dreishI've never created a symbol with a number at the end anyway. It sounds like a nasty habit.
14:02Chousereven single underscores are pretty uncommon.
14:02drewrdanlarkin: e.g., http://github.com/danlarkin/clojure-json/blob/9baaec1f1f714751b7be87974b41c21d1e5a3d6f/test/test.clj
14:02danlarkindrewr: in clojure-json? just an oversight I haven't yet fixed :)
14:02ChouserI was thinking about taking a crack at a patch to stuff line numbers into gensym names.
14:03dreishWell, if you do # auto-gensyms, there aren't any underscores.
14:03dreishOh, yes there are.
14:03Chouser,(identity `a#)
14:03clojurebota__1533__auto__
14:03dreishSorry, I either had an old version somewhere, or a brain malfunction.
14:03drewrdanlarkin: k
14:03Chousera whole raft of them :-)
14:04drewrdanlarkin: also, how do you handle Dates?
14:04dreishYeah, that's pretty theoretical then.
14:04drewrthat's what I'm struggling with at the moment
14:04drewrno existing lib seems to use ISO8601
14:04drewrrather, a hash of all the bean attrs
14:05danlarkindrewr: I don't handle dates -- but you can! check out the docstring for add-encoder
14:06drewrdanlarkin: Glossed over that. Nice.
14:09danlarkindrewr: 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:10drewrdanlarkin: it's about to get real serious up in here
14:20hiredmanclojurebot: length?
14:20clojurebotHuh?
14:20hiredmanclojurebot: length is <reply> count
14:20clojurebot'Sea, mhuise.
14:27cp2anyone around? im in need of help
14:27danlarkincp2: ask away, anyone who can help will offer it
14:27cp2right then
14:28cp2clojure 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:28cp2as in, (add-classpath "file:///c:/bcel/bcel-5.2.jar") does not work
14:28cp2nor does java -cp .;c:/bcel/bcel-5.2.jar -jar clojure.jar
14:29cp2i cant import any of the classes in the jar, results in ClassNotFoundException
14:29danlarkincp2: I think you can't muck with the classpath if you use -jar
14:29StartsWithKcp2: you can't use -cp and -jar
14:29cooldude127is the floor operation in clojure (Math/floor num) ?
14:30cp2well, that would explain part of it
14:30StartsWithKcooldude127: yes
14:30cp2it doesnt work from the emacs repl either (im using clojure box)
14:30hiredman,(doc floor)
14:30clojurebotjava.lang.Exception: Unable to resolve var: floor in this context
14:30hiredmanadd-classpath is funky
14:30hiredmanI would not rely on it
14:31cp2how would i go about adding to the classpath from emacs then?
14:31hiredmanthere is some slime thing
14:31hiredmanI don't emacs, so I don't know offhand
14:32cp2this seems to be what im looking for http://gnuvince.wordpress.com/2009/01/24/emacs-function-for-clojure-users/
14:33gnuvincecp2: beware, a part of the code is truncated; the last word is slime-lisp-implementations with all closing parens.
14:33cp2yeah, i noticed
14:33cp2oh haha, is that your wordpress?
14:34gnuvinceYes
14:34drewrdanlarkin: add-encoder works ok. I'm not sure I like the abstraction though. I'll be playing with it.
14:34eyerisClojureql 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:35cp2well, thank you
14:35danlarkindrewr: good to hear it's working for you, what do you like?
14:35Chousereyeris: clojure keywords can have capital letters, if that's what you're asking.
14:36eyerisChouser thanks.
14:36Chouserthough most SQL databases allow columns with spaces in their names, and clojure doesn't (or shouldn't) allow that.
14:37drewrdanlarkin: I like that it's all clojure, for starters.
14:37eyerisI wonder why ClojureQL converts them to lowercase. I just found the code responsible, but it doesn't give much insight.
14:37danlarkinChouser: are you sure it doesn't? (keyword "has spaces")
14:38danlarkindrewr: oops sorry! I mean't what _don't_ you like
14:38Chouserdanlarkin: but that's not readable again: http://code.google.com/p/clojure/issues/detail?id=13
14:39eyeris,(keyword "yes sir")
14:39clojurebot:yes sir
14:39Chouserthus my "(or shouldn't)" qualifier above. :-)
14:39danlarkinChouser: uh oh... that's going to break clojure-json :)
14:40danlarkinI would rather see that bug stay open
14:42hiredman:(
14:42Chouserhm, json allows spaces in its keys, doesn't it.
14:42danlarkinChouser: yeah
14:43danlarkinChouser: not only spaces but other invalid keyword type things
14:43cooldude127i'm really digging the way test-is groups tests and functions
14:43Chouserfor keys that are invalid keywords, you could just use strings.
14:43danlarkinor I should say non-readable keywords
14:44Chousereven as it is users would have to specify non-readable keys differently.
14:44Chouser(keyword "foo bar") since :foo bar isn't right
14:44danlarkinHm that's true
14:45Chouserso with that change, it'd actually be easier. :normal vs. "you asked for it"
14:45danlarkinyeah, maybe I'll make that change
14:45lawldoes anyone here know lisp??
14:46danlarkinI'm also exploiting it for my open purposes by creating a (symbol ",")
14:46drewrdanlarkin: It's not that I definitely don't like it. The return value just seems very brittle.
14:46dreishlawl: I'm strictly an Acorn BASIC programmer.
14:46drewrIncluding my own indentation? Why can't it use whatever the rest of the serialization is using?
14:47danlarkindrewr: well because if you want to encode your <whatever> as a collection you have to deal with your own indentation
14:47dreish10 PRINT "LOOK AROUND YOU";
14:47dreish20 GOTO 10
14:47dreishRUN
14:48drewrdanlarkin: yeah, I see what you mean.
14:48danlarkindrewr: like maybe your <whatever> is a collection of collections of hashes, I don't know how to deal with that
14:48lawlwat is clojure coded in
14:48danlarkinlawl: APL
14:49lawlreally
14:49bitbcktdanlarkin: I thought it was Malbolge?
14:50dreishbitbckt: Used to be, but that branch is no longer maintained.
14:52dreishlawl: 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:52hiredmandreish: nice
14:52lawlthey should have made it yellow
14:52Chousukeheh
14:52lawlclojure is programmed in itself??
14:52bitbcktyes, yellow would have made that graph much more legible
14:53ayrnieuthat's *normal*, lawl.
14:53Chousukelawl: there's the standard library
14:53dreishI think most Lisps implement a small core in another language, and then the rest is written using that core.
14:53Chousukethough even some of the java code actually emits clojure.
14:53Chouserthat's even true of most C compilers
14:54Chousukethe bootstrapping problem is interesting, though
14:54zakwilsonI think SBCL has a tiny assembly core and the rest is CL.
14:54danlarkindrewr: 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:56Chousukeyou code a crappy compiler; then compile a less crappy compiler using the crappy compiler, and use the result for subsequent compilations :P
14:56ayrnieuand 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:57lawlSUP GUYS
14:57dreishIt 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:57lawlassembler?
14:57Chousukedreish: yeah :P
14:58dreishASM is a Java library that allows you to generate Java classes on the fly, at runtime.
14:58Chousukebut needing clojure to compile clojure would make it unnecessarily complex I think
14:58dreishFrom what little I've learned from looking at it, it seems significantly higher level than what I'd think of as assembler.
14:58Chousukesince you can just use java.
14:59dreishWhat if you have just a JRE, no JDK?
14:59dreishAnd you just want to download a jar that will let you compile future versions?
15:00ChousukeMy guess is compiling clojure would depend on the JDK in any case.
15:00waltersit shouldn't actually I believe
15:00danlarkinRich 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:00waltersthe JRE can load bytecode just fine
15:00lawldoes anyoen else think lisp sux
15:00waltersand ASM generates bytecode directly, it doesn't run javac
15:00dreishdanlarkin: Yes, thankfully he's not the sort of person to meander down side paths like that.
15:01danlarkinaye aye
15:01waltersthe JDK is mostly about javac, javadocs etc. i think they're also shipping visualvm with it too now
15:01dreishlawl indeed.
15:01hiredmanwhat a misguided young man
15:02dreishMeh, I'm sure he thought it would be funny.
15:02danlarkina troll, just forget about him :-/
15:02dreishBut instead of running into a bunch of tightly-wound weirdos, he quickly got out-smartassed.
15:03Chousukea troll, here? this is officially an IRC channel now.
15:03technomancyclojurebot: #clojure
15:03clojurebotthis is not IRC, this is #clojure. We aspire to better than that.
15:03technomancy...
15:03bitbcktLies.
15:04hiredmanclojurebot: trolls is <reply>according to troll lore living beings move backwards through time
15:04clojurebotIn Ordnung
15:05ayrnieuChousuke, 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:06lawlshutup idiots
15:06dreishJust out of curiosity, do we have any ops?
15:06ayrnieu/msg chanserv access #clojure list
15:06dreishthx, I'm an irc newbie.
15:07danlarkin~seen jcowan
15:07clojurebotno, I have not seen seen jcowan
15:08ayrnieu/msg nickserv info jcowan
15:08dreishLast seen Mar 07 2008, from searching n01se.net
15:09Chouserit might be wise for someone to ask him to share some privs with a couple others who are here more often.
15:11danlarkinmaybe you or rich, someone he'd know
15:11RobertFischerHey there. What would people consider the major utilities/frameworks for/based on Clojure?
15:12technomancyRobertFischer: like apart from contrib?
15:12technomancyRobertFischer: for web stuff compojure seems to be the leader.
15:12Chouserrhickey: would you consider asking jcowan to share channel privs with yourself and/or others here you'd trust?
15:14RobertFischertechnomancy: Yeah, apart from contrib.
15:14RobertFischerI'm just curious to see what people are doing with Clojure.
15:14RobertFischerAside from talking about how awesome it is. :)
15:14danm_heh
15:14ayrnieuhttp://github.com/languages/Clojure
15:14technomancyoh sweet; Mire made it on to most watched
15:15technomancymust be a slow week; it also made it on to most forked. =)
15:15dreishThat page makes me want to push more often.
15:16technomancydreish: we can do it; we can take 22nd place and knock Scala into 23rd!
15:16technomancyRobertFischer: unfortunately talking about how awesome it is turns out to be a pretty time-consuming activity.
15:16RobertFischerApparently.
15:17technomancyso we outsource our programming; we make macros write our code for us.
15:17technomancysaves a lot of time in the end
15:18danm_sounds good
15:18Chousertechnomancy: ha!
15:18dreishIt looks like 11% Clojure isn't enough to get on the Clojure page.
15:20Chousukegithub 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:21technomancywell it's written in Ruby and hosts Rails
15:21Chouseris that in LOC?
15:21cooldude127i would guess num of projects
15:22dreishI'd guess number of projects, but they don't say. Could be number of watchers.
15:22hiredmancrap, that is a lot of javascript
15:22technomancyI think it's weighted though; active projects count more
15:25RobertFischerThey break down projects into their constituent languages: http://gist.github.com/RobertFischer/cornerstone/graphs/languages
15:25RobertFischerAnd I'm pretty sure that's LOC.
15:25dreishWow, that's some project.
15:26RobertFischerI don't mess around. :)
15:27dreishI just meant it's an unusual collection of languages.
15:29RobertFischerNot 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:29RobertFischerAlthough I'm starting to wonder if that would have been better implemented in Clojure.
15:29cooldude127am i allowed to modify a namespace? like i want to remove a mapping from it, how do i do that?
15:29RobertFischer(Don't tell #scala I said that.)
15:29hiredman,(doc un-map)
15:29clojurebotjava.lang.Exception: Unable to resolve var: un-map in this context
15:29hiredman,(doc unmap)
15:29clojurebotjava.lang.Exception: Unable to resolve var: unmap in this context
15:29hiredmancome on
15:29cooldude127(doc unmap)
15:29clojurebotHuh?
15:30hiredman,(doc ns-unmap)
15:30clojurebot"([ns sym]); Removes the mappings for the symbol from the namespace."
15:30cooldude127(doc ns-unmap)
15:30clojurebotRemoves the mappings for the symbol from the namespace.; arglists ([ns sym])
15:31Lau_of_DKGood evening gents
15:31cooldude127good afternoon
15:37brianhok. i must be having a senior moment. why would 'mod' be restricted to ints only?
15:37RobertFischerThe definition of "mod" is in the domain of ints.
15:37cooldude127brianh: the function is rem in clojure
15:37hiredmancooldude127: actually
15:37hiredman,(mod 30 4)
15:37clojurebot2
15:38cooldude127if i try that in my repl, it doesn't work
15:38brianhit's in the latest core
15:38cooldude127oh
15:38hiredmanclojurebot: latest?
15:38clojurebotlatest is 1235
15:38cooldude127what's the diff?
15:39hiredmanhmmmm
15:40hiredmanthat is incorrect
15:40hiredmanI have 1237 here
15:40cooldude127lol
15:40dreishIn the future, mod gets removed.
15:40dreishYou have a future version. Mystery solved.
15:40hiredmanhuh
15:40hiredmanno I have 1235
15:40brianhso using mod for say, unit circle degrees (as double), is considered mathematically incorrect?
15:41hiredmanmust have misread that
15:41cp2i 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:41cp2any suggestions?
15:41hiredmanah, rev 1237, but the last change was rev 1235
15:41Chouserbrianh: 'rem' works fine
15:41cooldude127brianh: just use rem
15:41dreish,(rem 2.3 1.2)
15:41clojurebot1.0999999999999999
15:42ayrnieucp2 - if you aren't continuing from a conversation I don't remember, please ask a complete question.
15:42cooldude127what was the point of adding mod?
15:42cp2ayrnieu i would consider that complete, but if you wish
15:42Chouser(prn (mod -5 2) (rem -5 2))
15:42Chouser,(prn (mod -5 2) (rem -5 2))
15:43clojurebot1 -1
15:43brianhI did. just wasn't sure what I was missing ;)
15:43cp2is there a better way than using a java array to hold the state of keys? i cant think of any other way
15:43cooldude127cp2: what do you mean by the "state of keys"
15:43ayrnieucp2 - what state? What keys? How are you going to use this state?
15:43cooldude127we're not sure what problem domain this is
15:43cp2as in, i want to store whether or not a key (on a keyboard..) is pressed
15:44ayrnieuhah, see, this is not on the same planet as what I assumed.
15:44dreishcp2: Ah, I think everyone was guessing either keys in a hash, or keywords.
15:44cp2yes
15:44cp2sorry, should have been more clear
15:44cooldude127cp2: ref of a vector?
15:44Chouserref of a set?
15:44cp2eh, could you show me example?
15:45dreish,(ref #{'shift 'ctrl 'a})
15:45clojurebot#<Ref clojure.lang.Ref@d8a125>
15:47cp2hrm
15:47cp2i think i see what you mean
15:47hiredman,(let [keys (ref #{'shift 'ctrl 'a})] (alter keys (partial select #(not= 'ctrl)) keys)
15:47clojurebotEval-in-box threw an exception:EOF while reading
15:47hiredman,(let [keys (ref #{'shift 'ctrl 'a})] (alter keys (partial select #(not= 'ctrl))) keys)
15:47clojurebotjava.lang.Exception: Unable to resolve symbol: select in this context
15:47dreishThen (dosync (alter some-var-holding-the-above disj 'shift))
15:47hiredman,(let [keys (ref #{'shift 'ctrl 'a})] (alter keys (partial clojure.set/select #(not= 'ctrl))) keys)
15:47clojurebotjava.lang.IllegalStateException: No transaction running
15:48hiredmanbah
15:48hiredmanyou get the idea
15:48cp2ye
15:48hiredman,(doc disj)
15:48clojurebot"([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:48hiredmanhuh
15:48hiredmansome new everyday
15:48hiredmansomething
15:48cp2thanks dreish, ill try it out
15:49Lau_of_DKGentlemen, 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:49Lau_of_DKcontain the word "commit" anywhere in the descriptions :)
15:50dreishLau_of_DK: with Perl ;)
15:51_knapr_how do I do something in a catcha nd how do I try multiple functions?
15:51Lau_of_DKdreish: It we work from the assumption that perl is the vomit of programming, have you got any other suggestions? :)
15:51hiredmanlike line-seq but break on \ncommit instead of \n
15:51dreishOoh, them's fightin' words.
15:52Lau_of_DKYes, giving that bad advice on #CLOJURE is a crime :)
15:53cp2so dreish, what would be the "opposite" of disj then
15:53dreishI'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:53cooldude127cp2: conj
15:53hiredman_knapr_: http://clojure.org/special_forms try catch is near the bottom
15:53cp2oh right
15:53cp2makes sense
15:54cp2thanks much, i got it now
15:56_knapr_can agents or refs notify each other?
15:57durka42agents can have watchers
15:57durka42both can have validation functions
15:57Chouserboth can have watchers now
15:57Chouser,(defmethod print-method clojure.lang.IRef [o w] (.write w (format "#<%s@%x: %s>" (.getSimpleName (class o)) (System/identityHashCode o) (pr-str @o))))
15:57clojurebot#<MultiFn clojure.lang.MultiFn@385715>
15:57Chouser,(ref '#{a b c})
15:57clojurebot#<Ref@bc7c0: #{a c b}>
15:58durka42cool
15:59Chouser,(let [a (atom 4)] (swap! a inc) (prn a) (swap! a + 10) (prn a))
15:59clojurebot#<Atom@ab58d: 5> #<Atom@ab58d: 15>
16:00hiredmanclojurebot: emotion is <reply>this model does not support emotionml as spec'd in http://www.w3.org/2005/Incubator/emotion/XGR-emotionml-20081120/
16:00clojurebotc'est bon!
16:01dreishWow, now I know the XML for a relaxed, positive state with a feeling of being in control of the situation.
16:02dreishCan we use that to fix the economy somehow?
16:06hiredmanman
16:06hiredmanthis spec is awesome
16:06hiredman<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:21eyerisThe JSON is the only contents of that file.
16:21eyeriserm, wrong channel
16:21ChouserIf 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:24hiredmannot having to boiler plate (try (catch)) everywhere
16:26Chouserhere's one opinion on the matter: http://www.mindview.net/Etc/Discussions/CheckedExceptions
16:34_knapr_so it means your app crashes instead...
16:34hiredmanonly if you don't handle the exception
16:35hiredmanactually clojurebot was throwing exceptions almost constantly, but kept working and I never noticed till I added a try catch block in somewhere
16:35hiredmanI not have a nil case for its main multimethod
16:35hiredmanI did not
16:35whiddenHas anyone been able to update their win32 clojure-box to the lasted clojure and clojure-contrib?
16:36Chouserbut java still has some unchecked exceptions, so your app could still crash even if it compiles ok
16:36_knapr_sure
16:36_knapr_hiredman: yes but you handle them by try catching right?
16:37_knapr_or a lot ifs instead?
16:37durka42to 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:37durka42QTJava
16:41BigTomHi, 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:43BigTomre, Recursion and Iteration, there is recursive functions that process recursively, and recursive functions that process iteratively. Is that right?
16:43ayrnieuyes, in SICP's terminology.
16:44BigTomand recur is Clojure's way of doing iterative recursive functions (in SICP speak)
16:44ayrnieuyes.
16:44BigTomand is Ackermann's function a complete mind f**k, or is that just me?
16:45Hunit is.
16:45BigTomphew :-)
16:45Hunn is more or less the degree of your function
16:45Hunerr
16:45Hunm
16:46Hun0, 1, 2 => O(n)
16:46Hun3 => expt(n)
16:46Hunand so on. think of knuth's arrow notation
16:46Hunthe extended one.
16:47BigTomah, and I was doing so well...
16:47BigTomI am having a late life comp sci education
16:47BigTomwell, better late than never
16:47Hundon't let that demotivate you. ackermann is not very practical :)
16:48BigTomI am just going to leap over it to Tree Recursion
16:48Hunyep. 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_knapr_you dont have to catch them but you are told which you arent
16:48shoover``whidden: XP or Vista?
16:51BigTomCool, oh well, only another 300 pages or so to get to Streams
16:51hiredmanclojurebot: checked exceptions?
16:51clojurebothttp://paste.lisp.org/display/74305
16:51Hunthere's a lot of great stuff in these pages, BigTom
16:51hiredmanclojurebot: checked exceptions is <reply>http://www.mindview.net/Etc/Discussions/CheckedExceptions
16:51clojurebotIk begrijp
16:51BigTomHun: thanks for the pointers.
16:55HunInspirating: http://fs6.depauw.edu:50080/~dharms/pdp11/
16:58BigTompdp11?
16:58Hunyep. very old computer
16:59Hunwas the machine the original unix was written on
16:59BigTomI know, very old, my Dad used to collate his marks on one
16:59BigTomHe was an agile client for the computer Dept in the 70's
17:00BigTomthey kept overreaching themselves
17:00Huni 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:02Huni 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:03Hunto 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:03BigTomThat's not cheating
17:03_knapr_you dont have to catch them but you are told which you arent
17:03hiredmansounds like a fun class
17:03Hunhiredman: 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:03Hunfirst we implemented a small cpu (16 bit address, data, 16 opcodes, 8 registers)
17:04BigTomI 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:04Hunafterwards each team added some cool stuff (like a pipeline, a vga port, some software, ...)
17:04Hunwe built a single precision fpu :)
17:04hiredmanwow
17:04Huni won't use floating point math from now on. that stuff is evil
17:05Huni used lisp (CL, not clojure. sorry ;) for validating everything
17:05Hunas we used ieee754 format for everything, i could just calculate on my main pc and compare results to find bugs
17:06Huni used randomized numbers for just about anything, so that i could fuzz failures out
17:06Hunthere was just one problem: with the integer math, everything worked out fine. but the floating point stuff were effectively just nops
17:07Hunso (+ float1 float2) == (max float1 float2)
17:07Hunbecause the values were so different that after all that shifting stuff, the smaller one was usually completely absorbed by the larger one
17:07Huntook me 2 hours to understand that `bug'
17:08hiredmanheh
17:08Hunthen i had to derandomize my random numbers to build proper tests
17:08Hunrandom numbers are hard
17:09BigTomHun: makes me wish I could go back to uni
17:09BigTomah well
17:09BigTomgotta go
17:09Hun:)
17:12_knapr_if i have a song playing, can i do, hwne (when (.isComplete player) dosomething)? like can it be event driven?
17:15durka42you could start a thread polling .isComplete
17:16walters_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:18Hunpolling is not necessarily bad, though it is in this case
17:18Hundone properly, it has hardly any impact on the performance
17:18waltersfrom the POV of an individual program maybe
17:19waltersbut if many program authors do it, it really does add up
17:19waltersa modern processor drains far less power in full sleep
17:19Huntrue
17:20Hunthough it wakes up a lot by the OS itself already
17:20waltersit == the JVM?
17:20hiredman_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:20Hunwalters: the cpu
17:20waltersHun: modern Linux kernels are tickless
17:21Hunon big computers maybe. my avr32 doesn't have that luxus, and that's where saving power really works :)
17:22hiredmanwalters: 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_knapr_isComplete
17:23waltershiredman: of course, but broadly speaking the applications are the problem nowadays, not the OS
17:23Hunyep
17:24hiredman_knapr_: then you are stuck polling
17:25whiddenshoover: sorry for the delay... meetings and all.. xp, what's vista ? ;)
17:26durka42oh dear
17:26durka42JVM bus error
17:26shoover``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_knapr_like in my app i dont have a giant-global-controlling-everything-thingie which can poll, notify, command etc
17:28walterswell, swing has something like that underneath, but i don't know if it has any API explicitly for it
17:28hiredman_knapr_: you just make a thread that loops and checks isComplete and fires some function when it is true
17:28Hunyou could just use an extra timeout-thread for the polling (which is ugly but should work)
17:28whiddenshoover: hmmm the generic works out fine.. when i update swank has issues.
17:29whiddeni'm going through the swank code looking for diffs right now.
17:29shoover``whidden: updated slime from cvs as well?
17:30whiddenshoover: 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:31shoover``it's all crucial. the two projects get out of sync easily
17:33whiddenShoover: argh... i know that/this feeling..
17:35shoover``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:39whiddenShoover: ok.. i've updated just the slime to latest and now repl connects but slime does not connect to the back end.
17:39shoover``errors, or just nothing?
17:40whiddenyes errors
17:40shoover``quagmire
17:40whiddenhow do i use pastebot?
17:40shoover``lisppaste8: url
17:40lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
17:42lisppaste8whidden pasted "clojure-box startup" at http://paste.lisp.org/display/74457
17:43whidden shoover: that's what i have with updated slime from cvs head, and from clojure head.
17:44hiredmanwhat is on line 261 of basic.clj?
17:45whiddenhiredman: 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:46lisppaste8whidden annotated #74457 with "function that errors" at http://paste.lisp.org/display/74457#1
17:47hiredman,clojure.lang.RT/ROOT_CLASSLOADER
17:47clojurebotjava.lang.Exception: No such namespace: clojure.lang.RT
17:47whiddenhiredman: clojure.lang.RT moved?
17:48hiredmandunno
17:48hiredmanI have not looked at the java source stuff in about three months
17:49Chouserno, ROOT_CLASSLOADER is gone or private
17:49whidden:(
17:49Chousertry (clojure.lang.RT/baseLoader)
17:49hiredmanyeah
17:49hiredmanprivate now
17:50Chousernote the parens where there weren't any before.
17:50hiredman,(clojure.lang.RT/baseLoader)
17:50clojurebot#<DynamicClassLoader clojure.lang.DynamicClassLoader@1b3f8f6>
17:50shoover``also, if you're using latest slime you also must use latest swank-clojure from github
17:50shoover``which by the way fixes the classloader change
17:51whiddenlol... i'm realizing that.
17:53lisppaste8whidden annotated #74457 with "latest swank-clojure" at http://paste.lisp.org/display/74457#2
17:53whiddenno errors, but slime not really happy yet.
17:53shoover``ok, then it's not just me. that's why I haven't pushed a new Clojure Box yet
17:53shoover``just press Enter
17:53hiredmaneww iso-latin?
17:54hiredmanis that an encoding? shame on you for not using utf-8
17:54whiddenwell slime not really there.. its passing strings down to repl and all but no tab completion, or understanding of clojure.
17:54shoover``oh yeah, there's one missing piece
17:54whidden?
17:56shoover``you need this in emacs/site-lisp/site-start.el, inside the swank-clojure-config call: (slime-setup '(slime-repl))
17:56shoover``
17:58_knapr_i dont understand how to create a thread queries another thread
17:58whiddeni have not swank-clojure stuff in that file.
17:59lisppaste8whidden annotated #74457 with "site-start.el" at http://paste.lisp.org/display/74457#3
17:59shoover``hiredman: slime passes that encoding to the swank-clojure world somehow. I'm not sure what determines it
17:59hiredman,(let [a (ref :b)] (.start (Thread. #(prinln a))))
17:59clojurebotjava.lang.Exception: Unable to resolve symbol: prinln in this context
17:59hiredman,(let [a (ref :b)] (.start (Thread. #(println a))))
17:59clojurebotnil
17:59hiredmanhmmm
18:00hiredman,(let [a (ref :b)] (.start (Thread. #(binding [*out* *out*] (println a)))))
18:00clojurebotnil
18:01hiredmananyway
18:01whidden_knapr_: what do you mean by query?
18:01hiredmansomething like that
18:01shoover``whidden: is there a default.el?
18:01whiddenyeppers
18:01shoover``ok. gotta go. good luck
18:02whiddengee and a config :)
18:02_knapr_whidden: i need to query if a a taks is finished
18:02_knapr_and all this has to run besides the main event thread
18:03whiddenShoover: thanks.. works
18:03hiredman_knapr_: you can make and start a new thread by passing a function of no args to Thread.
18:03hiredmanthen you call .start on the new thread to start it
18:04hiredmanI am pretty sure you did all this yesterday
18:04hiredmanlisppaste8: url
18:04lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
18:08_knapr_hiredman: yes
18:09_knapr_but i dont quite get communicztion between threads
18:09_knapr_how do iq uery a thread, if it constantly runs function x, that returns a bool
18:09scottjIsn'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:09hiredmanscottj: if-let?
18:09hiredman,(doc if-let)
18:09clojurebot"([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:10hiredmanoh
18:10hiredmanno
18:10hiredmannot if-let
18:10hiredman,(or :a :b)
18:10clojurebotjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Keyword
18:10Chouser(or foo bar)
18:10hiredmanuh
18:10hiredmanweird
18:11scottjthanks
18:16hiredman,(or :a :b)
18:16clojurebotjava.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:22hiredman_knapr_: you put an if in the thread that polls, and if isComplete it some function, or toggles some flag, or something
18:22hiredmanjesus
18:24Chouserhiredman: please keep the more colorful elements of your comments to yourself, if you don't mind. The rest are quite welcome.
18:24ayrnieubelatedly, Clojure For Erlang Programmers, part 1: "Clojure doesn't have what you will regard as meaningful support for concurrency." (Working on part 2.)
18:35hiredmanChouser: sorry
18:35bitbckthiredman: you're fired.
18:50achim_phi all! i've got a question about gen-class (chances are that it's a stupid one ...)
18:50achim_pis there a way to call methods on "this" from within the :init function?
18:51achim_pi'd like to replicate sth like this (-> paste)
18:51lisppaste8achim_p pasted "gen-class counterpart?" at http://paste.lisp.org/display/74463
19:01clojurebotsvn rev 1236; branch for trying fully-lazy sequences
19:01clojurebotsvn rev 1237; [lazy] added Seqable
19:01clojurebotsvn rev 1238; [lazy] added closed-over local tail clearing, for once-only fns, used in delay
19:24hiredmanhmmm
19:36Chouserachim_p: http://code.google.com/p/clojure/issues/detail?id=45
20:13lisppaste8knapr pasted "threadache" at http://paste.lisp.org/display/74469
20:14knapranyone good with swing+threads? have a look there plz
20:17Chouseryeah, you might want some (Thread/sleep 500) or something in your poll-thread fn
20:17ChouserI bet that pegs your CPU when it's playing.
20:18ChouserUsing 'def' as you do in play-next is discouraged. You should use a Ref for playlist.
20:20ChouserYou might try printing out the arg you send to utils/play-mp3 to make sure it's what you want.
20:20ChouserIf it is, then your problem is mostly likely in progs.mp3play.utils, which doesn't appear to be pasted there.
20:21lisppaste8knapr annotated #74469 with "untitled" at http://paste.lisp.org/display/74469#1
20:21Chousukeeventually you might want to remove that polling completely and instead have the player send a "finished" signal or callback whenever playback is complete.
20:21knaprnow it is, dont think that is the problem
20:21knapryes but to what should it send that?
20:21knaprand how do I add such a thing to the player?
20:23Chousukeknapr: also, (when (not= player nil)) == (when player)
20:23Chousukeunless player can be false, but in this case it probably won't be :)
20:23knaprthe 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:24Chousukeit's a method.
20:25Chousuke,(.run (Thread. #(do (Thread/sleep 1000) (println "Done sleeping"))))
20:25clojurebotDone sleeping
20:25Chousukelike that
20:26Chousuke(well, it's probably not visible unless you have timestamps, but there was a pause before clojurebot replied)
20:29knapryeah i see it but it still stops the music, i have 5000 sleep
20:32Chousukewait, in which thread are you sleeping?
20:32Chousukeknapr: are you sleeping in the polling thread?
20:33knapryes
20:33knaprthats whats weird
20:33lisppaste8knapr annotated #74469 with "untitled" at http://paste.lisp.org/display/74469#2
20:34Chousukeknapr: you can't do it like that.
20:35Chousukeknapr: your song-finished? function has the loop so the thread/sleep is never even executed because the "infinite" loop does not terminate
20:36knaprah
20:36knaprofc
20:37knapri need to resdesign the whole function then
20:37lisppaste8Chousuke annotated #74469 with "this" at http://paste.lisp.org/display/74469#3
20:38Chousukebut polling is inefficient and inaccurate anyway; the best solution would be to have the player tell you when it's done.
20:38Chousukebut I guess that'll do just fine as a preliminary solution :)
20:41knapryes thats what i want, do i have to implement some kind of ActionListener for that?
20:42ChousukeI don't know how your player works.
20:42knaprthats 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:42Chousukethe JVM knows which thread it is running
20:43knaprok
20:43knapri see
20:43knaprnice now it works, at least that part :)
20:43Chousukegood.
20:43Chousukenow I'll get some sleep.
20:44Chousukelater
20:51knaprwoot it actually works completely
21:05knapris there a way to loop over a java list?
21:06durka42map doesn't work?
21:13hiredmanknapr: well, to actually "loop" you would use (loop [] (recur))
21:14hiredmanbut most likely you could use map, or doseq, or something else
21:17arohneris 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:19arohnerI want a 'map-hash', where the return value of your map fn has to return key-value pairs
21:20durka42hash-map :)
21:21durka42(doc hash-map)
21:21clojurebotkeyval => key val Returns a new hash map with supplied mappings.; arglists ([] [& keyvals])
21:22dreishProbably (defn map-hash [f & seqs] (into {} (apply map f seqs))) would work, I guess.
21:22hiredman,(let [map-hash (comp (partial apply hash-map) mapcat)] (map-hash identity {:a 1 :b 2}))
21:22clojurebot{:a 1, :b 2}
21:23hiredman(comp (partial apply hash-map) mapcat)
21:33knaprhow do i catch multiple exceptions?
21:35gnuvince_knapr: multiple catches
21:36gnuvince_(try (catch Exception e ...) (catch AnotherException e ...))
21:47durka42woo! that took long enough
21:47durka42clojure has eyes
21:48durka42and by that i mean an iSight camera
21:48durka42it only took 140 lines, directly ported from java
21:49knaprhow long was the java code?
21:49lisppaste8knapr annotated #74469 with "untitled" at http://paste.lisp.org/display/74469#4
21:50knapranyone could chec that? why is that consuming the main thread when i start a new thread with low priority?
21:50durka42java was 205
21:50durka42clojure is 120 or so once i take out all the (prn "i'm still alive!")
21:50knaprlol
21:51durka42i kept moving that down line by line until i found the exceptions
21:51durka42debugging technique: replace any value with (do (prn "not dead yet") value)
21:57ozy`hmm, scala's on the shootout... quick, someone submit clojure programs :p
21:57ozy`http://shootout.alioth.debian.org <== c'mon, everybody's doing it...
22:06durka42should i put up this mess of QT code on pastebin?
22:06RaynesI didn't know Scala was on the shootout.
22:06RaynesI was looking for it yesterday, didn't look hard enough.
22:07durka42it's almost entirely a 70-line let statement
22:09Chouserdurka42: blog it!
22:10durka42that would require me to have a blog
22:10durka42i could start one
22:10Chouseryou sure could
22:10Chouseror second best, post it to the google group.
22:10Chousereither way will be more searchable than here, probably.
22:10durka42this entry titled, adventures in what happens when you try to port a mess of imperative java code to clojure
22:13durka42hmm i could try to use github-pages
22:17Chouserdurka42: wow, that looks nice.
22:19durka42Chouser: http://github.com/blog/272-github-pages
22:20Chouseryep, that's what I was reacting to.
22:21arohnerdurka42: thanks
22:22pjb3Is it possible to generate a named class at runtime?
22:25Chouseryes, but not in any clean supported way that I can think of.
22:25Chouserit used to be possible, but it tended to cause problems.
22:39pjb3So I'm trying to generate the most basic class possible
22:39pjb3I created a file in a directory ex call foo.clj
22:40pjb3All it has in it is: (ns ex.Foo (:gen-class))
22:40pjb3Then I start clojure in the directory that contains ex with: java -cp .:/clojure.jar clojure.lang.Repl
22:40pjb3user=> (compile 'ex.foo)
22:40pjb3java.io.IOException: No such file or directory (foo.clj:1)
22:42Chouserpjb3: what's your *compile-path* ?
22:43Chouser,(prn *compile-path*)
22:43clojurebotnil
22:43pjb3I think moving into a sub-directory fixed it, hold on
22:45pjb3(prn *compile-path*) is "classes"
22:45Chouseryou need that in your classpath
22:45pjb3I suppose that means it expects to have a directory relative to the current directory called classes to put the compiled files into?
22:46Chouserjava -cp .:/clojure.jar:classes clojure.lang.Repl
22:46pjb3Chouser: yeah that does it, thanks
22:48durka42clojurebot: logs?
22:48clojurebotlogs is http://clojure-log.n01se.net/
22:48durka42Chouser: is it down?
22:49durka42can one implement a constructor using proxy?
22:50Chouserdurka42: it does appear to be down.
22:57knaprhttp://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:59hiredman(play-next playlist) should be #(play-next playlist)
23:00hiredmanyou ned to pass a function to Thread.
23:00hiredman #(play-next playlist) is short for (fn [] (play-next playlist))
23:02knaprah ofc that again
23:02knapru told me yesterday
23:02knaprgreat now it works!
23:02knaprno it is just polishing hte thing that is left
23:07Chouserdurka42: log's back
23:09danlarkinlooking through contrib... it has grown a lot in the past month
23:11danlarkin*gasp* there's json code in contrib :(
23:14Chouserdanlarkin: perhaps he didn't know about your lib. Have you announced it on the google group?
23:14danlarkinChouser: no, never got around to that
23:15ChouserYou should.
23:15Chouser:-)
23:15danlarkinevery one
23:17danlarkinyeahh maybe I should
23:21hiredman,(doc slurp)
23:21clojurebot"([f]); Reads the file named by f into a string and returns it."
23:24danlarkinmmmmm Chouser do it for me, I don't wanna :-/
23:24Chouserannounce your lib!?
23:24danlarkinhahah
23:24danlarkinyeah why not
23:25ChouserI post too much there already.
23:25danlarkinYou're better with prose than I
23:25durka42sweet
23:25durka42laser-pointer tracking enabled
23:26knaprwhat is the bets way to use BufferedReader?
23:26knaprlike i want to read each lne and for each lien do something
23:26durka42line-seq
23:26hiredmanknapr: slurp will read a file into a string
23:28pjb3Ack! http://clojure.org down!
23:29lisppaste8knapr pasted "hmm?" at http://paste.lisp.org/display/74474
23:29knaprwhats up with that? i get it when i start the repl
23:31Chouserknapr: rebuilt clojure.jar recently?
23:31ChouserI'd clean and rebuild
23:33knaprbut what does the error mean?
23:33cp2corrupt classfile
23:34ChouserI think it means "clean and rebuild your clojure.jar". But that's just a guess.
23:35durka42ah, the old PleaseTryThatAgainException
23:39danlarkinheh, I'll tell ya... code reloading is tricky to get right
23:39danlarkingotta use those (defonce)s right!
23:42hiredmanoverheard in #java:
23:42hiredmanjavabot : phix, 'Some people, when confronted with a problem, think "I know, I'll use date!" Now they have two problems.'
23:42danlarkinhaha
23:42knaprso
23:42pjb3When talking about macros you talk about expansion time and compile time
23:42knapri never built it in the first place
23:42pjb3and I get the idea of expansion time
23:43pjb3but what is compile time, is that different than evaluation?
23:43pjb3For example, does the expression (+ 1 2) get compiled?
23:44hiredmanclojure has a sameworld compiler so compilation and evaluation is the same
23:44hiredmanoh
23:44hiredmanwell
23:44hiredmanYes
23:44pjb3So (+ 1 2) doesn't just get evaluated? It gets compiled, then evaluated?
23:44pjb3What does it get compiled into?
23:44hiredmanjvm butecode
23:45hiredmanbytecode
23:46pjb3Really? Every time I do (+ 1 2), bytecode compilation happens?
23:46hiredmanfrom my understanding, yes
23:46hiredmanalthough
23:46hiredmanno
23:46hiredmanwait
23:46hiredmanwell
23:46hiredmanyes
23:46hiredmana very little does
23:47hiredman+ is already compiled
23:48hiredman2009: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:49pjb3ok, eval I get
23:49hiredmanemphasis on the "Clojure is not interpreted" bit
23:50pjb3Right, so my assumption was that the functions get compiled to bytecode, but once that happens, you can just eval them
23:51pjb3so bytecode compilation has to occur when you do (defn f [x] (* x x))
23:51pjb3but then when you do (f 3), it's the same thing as calling a method in java
23:52hiredmanHuh
23:52pjb3I suppose you still need to turn (f 3) into the java data strucutres
23:52hiredmanbut a method call to java is bytecode
23:52hiredmanjava is also compiled and run
23:52whiddenif I might chime in. I think the REPL might be getting in the way of clarification.
23:53pjb3whidden: please do :)
23:53whiddenmy take and understanding, is this.
23:53whiddenthe function (defn f[x] (* x x)) is taken in either at REPL or load-file
23:54whiddenand compiled into jvm byte code
23:54whiddenfrom REPL the invokation of said function f is
23:54whiddenmade as a method call
23:55whiddenala the jvm mechanisms
23:55hiredmanbut a method call is jvm bytecode
23:55whiddenfor the REPL probably
23:55whiddens/for/from/
23:56whiddenbut the hotspot compiler will have a chance to work on the method if it sees a lot of activity.
23:56hiredmanwhidden: are you saying it isn't if you aren't using the repl?
23:56hiredmanwhidden: the optimizer vanishing awya your code is a whole nother mater
23:56whiddenif you arn't using REPL then you are working with only byte code, as that' what the clojure compiler produces.
23:57hiredmaneven at the repl you must be using bytecode
23:57hiredmanbecause that is all there is
23:57whiddenwith REPL you are going through a lot of invoke and method ... <name escapes me right now>
23:57hiredmanjava does not run "on top" of the bytecode somewhere, so you can reach up and call it
23:58whiddeni.e. a lot of method look ups
23:58whiddenright
23:58whiddenits really jvm
23:58hiredmanso the only way to interact with java or the jvm is through bytecode
23:59hiredmanit just happens to be the byte code for invoke and method what have you
23:59whiddenand with the helping hand of REPL, which provides convience methods for doing just that.
23:59durka42namely eval