#clojure log - Aug 17 2009

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

0:00 JAS415: god

0:00 i hate java

0:01 there really has to be 10 types of image?

0:01 all which are incompatible and have to be transformed in some sort of abstract voodoo?

0:01 and once you transform them they don't even work but come up as blank images

0:02 i've fought with this all day and it doesn't even display properly!

0:02 wtf.

0:02 i could have implemented my own image library in this time or something

0:42 cemerick: JAS415: is there a much better imaging library elsewhere? JAI is pretty darn spiffy these days. I remember hating the stuff in python, FWIW.

0:42 JAS415: JAI?

0:43 i'm trying to use the builtins and i just can't make it work

0:43 cemerick: java advanced imaging

0:43 JAS415: i'm using toolkit to read an image from a url and then i want to save it to file, so i convert to a buffered image and try to save it

0:44 it seems like simple stuff, but i'm just too incompetent i guess

0:45 so either

0:45 i end up throwing an exception that is basically meaningless

0:45 'invalid argument to native writeImage'

0:45 or 1/2 of the images come up empty

0:46 honestly is driving me nuts

0:46 cemerick: JAS415: it doesn't get much easier than this: http://java.sun.com/javase/6/docs/api/javax/imageio/ImageIO.html#write(java.awt.image.RenderedImage,%20java.lang.String,%20java.io.File)

0:46 You need a buffered image, but that's pretty straightforward (and chances are, the image you have is already a bufferedimage)

0:47 JAS415: yeah i have one

0:47 in fact i'm using that

0:47 i'm using exactly that

0:47 i've had it writing to file

0:47 its just that like

0:48 sometimes it works sometimes it doesn't

0:48 its completely hit or miss

0:48 cemerick: well, then you've got some images with oddball ColorModels and such

0:48 we did some testing of the .NET libs, and they have much weaker support for such ColorModels than java's image libraries, FWIW

0:49 we ended up writing a pile of code to normalize all sorts of strange imaging details. Color models, bit packing approaches, etc. I'm not familiar with the details of that.

0:50 JAS415: i don't even know about color models

0:50 all i'm doing is getting images from a url

0:51 converting them to buffered

0:51 and writing to file

0:51 i'm just freaking exhausted at this point

0:51 cemerick: how are you converting them to BufferedImages?

0:51 JAS415: (defn to-buffered-image [image]

0:51 (let [b (new BufferedImage (.getWidth image) (.getHeight image) BufferedImage/TYPE_INT_ARGB)

0:51 g (.createGraphics b)]

0:51 (.drawImage g image (new java.awt.geom.AffineTransform) nil)

0:51 b))

0:52 that didn't work well

0:52 cemerick: right. If the image doesn't have a color model compatible with ARGB, then you won't be happy

0:53 is the raw Image you get from the URL load not a BufferedImage already?

0:53 JAS415: hold on i'll put it on lisppaste

0:54 lisppaste8: Jon pasted "I can't get this to work.." at http://paste.lisp.org/display/85501

0:54 JAS415: granted I had it moderately working before

0:54 and now it is just not working at all

0:55 cemerick: and your overall objective is?

0:55 JAS415: ok

0:56 access image, convert to buffered image, cache on disk, display as imageicon

0:56 later, retrieve from disk instead of going out to the web

0:56 cemerick: why convert it to a buffered image? Is it not already one when you get it back from the toolkit?

0:57 JAS415: it is a ToolkitImage

0:57 which is not a buffered Image

0:58 so

0:58 you can't save a toolkit image to disk

0:58 but you can save a bufferedimage to disk

0:58 i think

0:59 cemerick: I'd use ImageIO.read to get the URL's image data (once you have an inputstream to it), rather than toolkit

0:59 JAS415: hmm

0:59 cemerick: then you're always working with buffered images

0:59 JAS415: good point

0:59 I will do try to do that

1:00 cemerick: I have no idea what majick is going on with toolkitimage -- it looks like it only decodes the image data lazily, so there's no way to get it's color model, etc.

1:00 good luck :-)

1:00 * cemerick is off to bed

1:00 JAS415: thanks :-)

1:06 Knekk: is there a way I can override the symbol's print representation? i.e. (println `+) => + and not clojure.core/+ ?

1:21 arbscht: Knekk: syntax-quote will resolve the symbol. (println '+) might achieve what you want; or generally (name '+)

2:42 lowlycoder: hey,

2:42 sorry for wasting a line

2:42 how do i get clojure to print out the clss path for me?

2:42 (.System (.Property)) is printing out too much shit

2:42 err, sorry for language

2:45 tomoj: (System/getProperty "java.class.path") ?

2:46 lowlycoder: cool; thanks

2:46 okay, so I have: .:/usr/share/java/jogl.jar:/usr/share/java/gluegen-rt.jar:/home/x/.jars/clojure-contrib.jar:/home/x/.jars/clojure.jar:/home/x/.jars/vimclojure.jar:/home/x/.jars/nailgun-0.7.1.jar

2:46 tomoj: what's (.System (.Property))?

2:46 that doesn't make sense to me

2:47 lowlycoder: and in jogl.jar, I have: com.sun.opengl.impl.x11.X11GLDrawableFactory , yet when I run the opengl-gears.clj demo ... I get a complaint of:

2:47 #<CompilerException java.lang.NoClassDefFoundError: Could not initialize class com.sun.opengl.impl.x11.X11GLDrawableFactory (opengl-gears.clj:0)>

2:47 the above is me being stupid since im learning clojure

2:50 arbscht: what's in opengl-gears.clj?

3:00 lowlycoder: (System/getProperty "java.class.path") gives me: ".:/usr/share/java/jogl.jar:/usr/share/java/gluegen-rt.jar:/home/x/.jars/clojure-contrib.jar:/home/x/.jars/clojure.jar:/home/x/.jars/vimclojure.jar:/home/x/.jars/nailgun-0.7.1.jar"

3:01 /usr/share/java/jogl.jar contains: com/sun/opengl/impl/x11/X11GLDrawableFactory.class

3:01 yet when I try to do: (import '(com.sun.opengl.impl.x11 X11GLDrawableFactory))

3:01 i get an error of: #<CompilerException java.lang.NoClassDefFoundError: Could not initialize class com.sun.opengl.impl.x11.X11GLDrawableFactory (test.clj:0)>

3:01 what's going on?

3:06 hiredman: clojurebot: how many things do you know?

3:06 clojurebot: I don't understand.

3:06 hiredman: clojurebot: how much do you know?

3:06 clojurebot: I know 337 things

3:07 hiredman: crap

3:07 sorry

3:30 lowlycoder: what's the equiv of: "import java.awt.*" ?

3:31 Fossi: lowlycoder: there's none

3:32 tomoj: yay clojurebot is back

3:32 Fossi: afaik at least

3:32 lowlycoder: so i have to load them one by one?

3:40 tomoj: you have to import whichever classes you want to refer to by a short name

4:10 lowlycoder: how do I connect to a cojure server, see what all the active threads are

4:10 and then selectively kill them?

4:11 err sorry, let me rephrase that

4:11 i'm at a clojure repl

4:11 how do I get a list of all active java threads

4:11 and then kill them

4:19 arbscht: wahey, clojurebot :)

4:32 lowlycoder: something like this can get you a seq of threads http://gist.github.com/168997

4:33 lowlycoder: whoa, did you write that just for me?

4:33 MidKnight: testing...

4:33 arbscht: sure, just a quick proof of concept

4:34 lowlycoder: so i get somethign looking like: (#<ReferenceHandler Thread[Reference Handler,10,system]> #<FinalizerThread Thread[Finalizer,8,system]> #<Thread Thread[Signal Dispatcher,9,system]> #<Thread Thread[Java2D Disposer,10,system]> #<Thread Thread[NGServer(/, 2113),5,main]> #<Thread Thread[DestroyJavaVM,5,main]> #<NGSession Thread[NGSession 1: (idle),5,main]> #<NGSession Thread[NGSession 2: de.kotka.vimclojure.nails.Repl,5,main]> #<Thr

4:34 MidKnight: Hey everyone, I am brand new to Clojure

4:34 lowlycoder: err, sorry

4:34 please don't kick ban

4:34 did not mean to paste that much

4:35 arbscht: the point is clojure threads are just java threads; you can play with them via the java api

4:35 lowlycoder: http://paste.lisp.org/display/85505

4:35 sorry for dumb question

4:35 how do I ask it to kill all the ones named de.kotka.vimclojure.nails.* ?

4:36 wait, that's actually not all that I want to kill

4:36 hmm

4:36 Fossi: hi MidKnight

4:36 arbscht: ideally, you wouldn't... Thread/stop is deprecated

4:37 lowlycoder: so what should I be doing isntead?

4:38 MidKnight: Hi fossi

4:39 arbscht: spawn threads which check for a signal to live or die, for example. the java docs describe this in detail

4:39 http://java.sun.com/javase/6/docs/technotes/guides/concurrency/threadPrimitiveDeprecation.html

4:39 lowlycoder: arbscht: which java docs? (sorry, i'm new to java)

4:39 nice; thanks

4:41 private volatile Thread blinker;

4:41 public void stop() {

4:41 blinker = null;

4:41 }

4:41 wtf? have it garbage collected?

4:41 is that the idea?

4:42 no wait; that's not how it works

4:42 why does blinker have to be volatile?

4:42 because it can change between threads?

4:45 arbscht: volatile ensures that any readers will get the latest value, so nobody will get a stale value and ignore the stop state if it's updated simultaneously

4:46 lowlycoder: is Thread/stop is deprecated; and I write a runaway thread; how do I kill it?

4:47 AWizzArd: Sun suggests that the thread itself should check for the state of some var as a signal to just stop.

4:47 lowlycoder: right; but if I screw up on that; there's no way to fix it?

4:47 suppose i'm running this mission criticial jvm that can't be taken down

4:48 arbscht: I guess you could risk Thread/stop for a one-off. but don't rely on it for real use. and don't write runaway threads :)

4:48 lowlycoder: and some newb intern throws on their a thread that just while(1) { allocate lots of crap}

4:48 it just eats up the jvm ram?

4:49 arbscht: if it's mission critical, do you want to risk corrupting its state? you might kill the thread but you can't trust its state

4:49 AWizzArd: In principle one should still be able to stop a thread with that method. Have a look at the source code of the Thread class .../j2se/src/share/classes/java/lang/Thread.java

4:52 lowlycoder: okay, so i'm using vimclojure

4:53 what's the easiest way to leat each "reloadfile" kill the previous one

4:53 hmm, this question is poorly asked

5:21 ole3: hello i like to split my project into different files, where do i put the package description (e.g. ns) ?

5:25 Chousuke: ole3: the ns declaration should be in the file that corresponds to the namespace.

5:26 ole3: to split your project, you can either have multiple namespaces, or use load-file

5:32 ole3: Chousuke: like: project.clj: (ns project (:import (java.io File FileInputStream))) (load-file "file1.clj") (load-file "file2.clj")

5:33 Chousuke: yeah. though usually your ns declaration should have at least two parts.

5:36 ole3: Chousuke: What parts?

5:36 Chousuke: as in. ole3.project

5:36 and then put the code in ole3/project.clj

5:36 ole3: ah, ok thank you

5:37 Chousuke: and add the directory where ole3/ is to classpath

5:38 ole3: ok

5:40 Is it ok to mix java and clj in a directory tree, or should they keep in seperate trees?

5:46 Fossi: i guess it would be okay, but uncommon

5:47 to me it would signal a pretty strong dependency

6:05 rottcodd: how can I check if an object is a java array?

6:20 y-combinator: Hello, im running Clojure on Mac with Java version "$ java -version

6:20 java version "1.6.0_13"

6:20 Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211)

6:20 Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-83, mixed mode)" and im experience strange problems building some libraries in Ant. My colleague builded exactly same libs(clj-record, clojure-ant-tasks) on windows machine and everything builds fine. Maybe I need some specific setting for Apple JRE?

6:21 rsynnott: what sort of errors are you getting?

6:21 was the colleague using Java1.5 or 1.6?

6:22 y-combinator: some random problems with classpath

6:22 he is used latest version of java 1.6 from Sun

6:22 $ ant

6:22 Buildfile: build.xml

6:22 def-tasks:


6:22 java.lang.ExceptionInInitializerError

6:22 at java.lang.Class.forName0(Native Method)

6:22 at java.lang.Class.forName(Class.java:242)

6:22 at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:583)

6:22 at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:228)

6:22 at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)

6:30 ok, solved by running ant with "-noclasspath"

8:13 cemerick: holy crap, git-bisect is wonderful

8:14 Chouser: when you need it, it's exactly what you need.

8:14 Chousuke: heh.

8:15 * Chouser tries to tab-complete rhi and is disappointed.

8:15 Chousuke: it does require some discipline in your commits to have git-bisect work well, though.

8:15 cemerick: Chousuke: how so?

8:15 Chousuke: if some commit breaks your build. it'll make git bisect less useful.

8:16 arbscht: Chouser: as bad as ,expr failing? the channel felt empty without clojurebot

8:16 cemerick: ah, right

8:16 Chousuke: you'll skip the broken commit of course, but then you might end up with the wrong commit being blamed for breakage :/

8:16 Fossi: well, at least you can have local commits in git that don't show up in the blessed repo

8:16 unlike hg

8:16 cemerick: seems like that makes rebase even more important, so that interim commits don't ever make it into an authoritative repo

8:17 Chousuke: yeah, squashing "oops" commits is a nice way to keep development history clean

8:18 cemerick: stuff like this keeps reminding me that I made the right decision on git vs. hg :-P

8:20 Chousuke: I think the main differene is that in hg every clone is (apparently) a branch while in git every clone is a repository, with multiple branches.

8:22 cemerick: well, there's no rebase in hg. That was my biggest issue with it.

8:54 ole3: hi, now my little project is working, but how do i create an executable?

8:55 Chousuke: you usually don't. but you can make it a jar.

8:55 ole3: why not?

8:56 Chousuke: well, java projects are usually distributed as jars

8:56 cark: hum i usually do =)

8:56 ahyes an executable jar yes

8:56 Chousuke: but I have to say I have no idea how to make jars myself :P

8:56 ole3: executable jar? a script?

8:57 cark: you know, a jar that can be started easily like this : java -jar myjar.jar

8:57 hamza: hey guys, i have this situation i declare a ref to my main application window from file a (main entry for the application) i would like to access this ref from file b but i get an error during include phase cause ref is not declared yet. how can i solve this?

8:58 ole3: ok, so i need to generate class files somehow

8:58 cark: ole3 : you could do without it, but yes you can do class file generation, AOT compilation

8:58 Chousuke: http://asymmetrical-view.com/2009/06/22/executable-clojure-jars.html

8:58 cemerick: ole3: not necessarily

8:58 or, http://www.google.com/search?q=executable+jars </snarky>

8:59 Chousuke: some of the google hits are obsolete information though.

8:59 having references to gen-and-save-class :|

9:00 cark: ole3 : it takes a bit of research to have a good build process ...

9:00 hamza : declare your ref from a file that will be imported from both files

9:01 Chousuke: ole3: the clojure unit of compilation is a namespace.

9:01 cark: from/if

9:01 of =/

9:01 damn i need coffee =)

9:01 Chousuke: ole3: so if you have a namespace in your classpath, (compile 'your.namespace) will compile it

9:01 ole3: ok, but a source file needs the jna library so compile failed

9:02 but jna.jar is in the classpath

9:02 Chousuke: hmm

9:03 Chouser: you don't really need to compile -- for your jar to be stand-alone you'll have to include most of Clojure anyway

9:04 Chousuke: yeah. it'll probably be easier to just put your .clj files in there

9:04 Chouser: just stuff all your support libs and your .clj's into a jar, use the manifest to point to your main class, and pack it up.

9:04 hm. I guess I usually genclass a main menthod. :-/

9:04 ole3: ok, i will try that, thanks

9:05 Chouser: I wonder if you can provide command-line args in the manifest so that you can use clojure.main as your jar's main.

9:05 cark: someone should do a nice writeup on how to do the full build process

9:05 too bad i don't have a blog

9:07 ole3: clojure application delivery is like common lisp application deliver :)

9:07 Chouser: oh, really? CL want's you to write ant scripts in XML too?

9:07 :-) :-)

9:07 cark: i do it more like c ... using ant as make

9:08 Chousuke: dealing with jars and clojure is a bit painful still I guess.

9:08 cark: the pain comes from ant

9:08 i really can't stand xml

9:08 Chousuke: but I suppose that'll get better as Clojure matures.

9:09 XML itself is not horrible, but the way ant uses it is :(

9:09 cark: well as soon as the xml file is more than a page long, it becomes unreadable

9:09 cemerick: neither ant nor jars are particularly difficult....

9:10 cark: cemerick : difficult to read

9:10 that's write only stuff

9:10 cemerick: the clojure buildfile itself produces an executable jar in about 12 lines *shrug*

9:11 cark: right, but you might want to have libs automatically added for instance

9:11 then make nice zip

9:11 cemerick: from contrib, you mean?

9:11 cark: all the libs for your application

9:11 cemerick: lisppaste8: url?

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

9:13 cemerick pasted "seriously, producing jars containing your clojure code and others' libs isn't hard..." at http://paste.lisp.org/display/85515

9:13 cark: that's part of it

9:13 cemerick: besides that, there's nothing stopping anyone from using make, rake, etc etc

9:13 lisppaste8: cark pasted "there is more to it" at http://paste.lisp.org/display/85516

9:14 Neronus: or custom binary executables

9:14 cark: it takes a while to have someting that works ...anyways i'm past that so i don't care =D

9:14 cemerick: cark: I think you just described *all* build processes/tools ;-)

9:15 cark: hehe you might be right indeed

9:15 i just which we would have some neat stuff in clojure

9:15 with all the capabilities of ant

9:15 * Chouser whispers "lancet"

9:15 cemerick: yeah, I was just about to say that

9:16 cark: my understanding was that lancet was a wrapper around ant ?

9:16 Chouser: a wrapper that avoids the xml I believe

9:17 cemerick: I don't know if avoiding XML is the biggest issue with build processes.

9:17 I made my peace with it/ant when I used rake for a build process (after hearing about how much simpler it was), and still ended up with a (functional) hairball.

10:06 ole3: ok, now I have two directories lib and src.

10:06 In lib is clojure.jar and jna.jar

10:06 in src is com/etc/projects/....

10:07 and i have a shell script starting the clojure repl and loading the project.

10:07 Thanks for your help.

10:48 weissj: cemerick: i am using lancet, because i hate ant's xml. lancet is actually really cool - it lets you use ant via real prog lang, rather than that xml crap

11:08 cemerick: weissj: yeah, I'll take a look at it eventually. It's hard to justify spending time on build processes that work, though. :-)

11:41 Chouser: (.toCharArray (build-string "foo" "bar"):String) ?

11:42 (defn build-string:String [& args] ...) ?

11:44 Chousuke: Chouser: hmm.

11:45 Chouser: Chousuke: exactly.

11:45 cemerick: any thoughts?

11:46 stuartsierra: The former would complicate the reader. The latter looks like :String is part of the name.

11:46 Chousuke: I wonder if I should implement #() as a macro for my reader.

11:46 cemerick: Chouser: yeah, call-site hinting requires a reader change

11:46 Chousuke: having it expand to (auto-fn ...)

11:46 Chouser: right, but would those forms even be desirable?

11:47 cemerick: ah, that's a different question :-)

11:47 I thought you were trying to use the defh or something.

11:47 Chousuke: then I could possibly allow nested #()s

11:47 hmm.)

11:48 Chouser: Chousuke: #() were originally allowed.

11:48 er nested #() were originally allowed

11:48 cemerick: Chouser: well, that's worth discussing. I *think* so.

11:48 Chousuke: I'm running out of features to implement for my reader

11:48 Chouser: Chousuke: cool!

11:49 Chousuke: soon I will have to start worrying about the metadata stuff

11:49 cemerick: The #^Blah hieroglyphics are a wart, IMO, and they don't get better with age and more usage.

11:50 Chouser: They're visually messy, but semanticly clean.

11:50 I'm worried foo:Type reverses that.

11:50 foo:{:other :meta-data} ??

11:51 Chousuke: I already have strings, numbers, basic symbol parsing, regex patterns, lists, maps sets and vectors

11:51 of the more complicated reader macros, I'm missing #< and #= :/

11:51 cemerick: well, I'm definitely not suggesting foo:Blah as a generalized replacement for metadata -- just sugar for type hinting

11:52 Maybe that means it's useful binding forms, but not at call-sites.

11:52 (given hinting the latter is generally less common?)

11:53 Neronus: What do #< and #= do?

11:53 Chousuke: I think #<foo> is "fail!" and #= is read-time eval.

11:54 Neronus: To the first.. d'oh of course, to the second: nice

11:54 Chousuke: but I need to double-check their semantics :P

11:54 Neronus: thank you

11:54 Chousuke: Clojure uses #<> to print out unreadable things.

11:56 Neronus: yeah, like CL does

11:57 sometimes I wish regexps were callable like sets are, so that i could do (filter #"foo" seq)

11:58 Chousuke: that's unfortunately not possible until Clojure starts doing interface injection :P

11:58 which would be cool, but might never happen :(

12:01 stuartsierra: Is anyone actually using clojure.contrib.http.apent?

12:01 Neronus: Wouldn't it be possible to just subclass java.util.regex.Pattern, and make that class implement IFn?

12:01 stuartsierra: Neronus: no, Pattern is final.

12:01 Neronus: aw, that sucks

12:01 thanks anyway

12:03 Chouser: (defn re-seqer [r] (partial re-seq r)) might be interesting to play with.

12:05 Chousuke: Hm, I think I'll get a cup of coffee and see how quickly I can implement keyword reading support.

12:15 drewr: stuartsierra: I'm using it, but you knew that

12:16 AWizzArd: ~seen rhickey

12:16 clojurebot: no, I have not seen rhickey

12:16 Chousuke: hmm, 10 minutes. not bad :P

12:16 AWizzArd: ~seen Chousuke

12:16 clojurebot: Chousuke was last seen in #clojure, 0 minutes ago saying: hmm, 10 minutes. not bad :P

12:16 AWizzArd: ~seen kotarak

12:16 clojurebot: no, I have not seen kotarak

12:17 Chousuke: ooh, when did clojurebot return?

12:17 clojurebot: botsnack

12:17 clojurebot: thanks; that was delicious. (nom nom nom)

12:18 stuartsierra: drewr: I'm working on an improved interface: https://www.assembla.com/spaces/clojure-contrib/tickets/15-Streamline-clojure-contrib-http-agent-interface

12:18 drewr: I think I like those ideas

12:19 although I'm only using response-body-str atm

12:19 from a POST

12:19 stuartsierra: right, so I want to simplify that common case, probably to simply "string".

12:21 drewr: I created what amounts to a (result-str URL PAYLOAD) for my use

12:21 stuartsierra: ok

12:21 Next step is a higher level interface with functions like get/post/put.

12:21 But that will be a separate lib.

12:22 drewr: I can envision some multimethods for different content-types

12:23 when PAYLOAD is xml, set content-type header to application/xml etc.

12:23 stuartsierra: Yeah, I'm not sure how to handle that yet.

12:23 e.g., How do you recognize XML if it's generated as a String?

12:24 drewr: you wouldn't have to make it that smart, but you could require a <?xml...> declaration first or something

12:28 stuartsierra: Sounds a little too magical to me. But it could dispatch on a keyword, like :xml, :text, :json.

12:28 drewr: yep

12:29 JAS415: ~seen AWizzArd

12:29 clojurebot: AWizzArd was last seen in #clojure, 12 minutes ago saying: ~seen kotarak

12:53 stuartsierra: Can HTTP response headers ever contain spaces?

12:56 drewr: stuartsierra: where?

12:56 keys? values?

12:56 stuartsierra: In the field name, the key.

12:56 drewr: I would guess that even if it's allowed, it's not recommended; I've never seen a space there

12:57 stuartsierra: If I'm reading the spec right, it's not allowed. Good, that means I can use keywords as header names.

13:04 Should the response body methods block until the response is completed?

13:04 (Right now they return nil if the HTTP request hasn't completed.)

13:04 Chouser: not if you can start reading the head of the stream before the tail is done.

13:05 stuartsierra: That's already allowed by passing a handler function when you start the request.

13:06 Chousuke: hm

13:06 stuartsierra: Basically, you call (http-agent "url" :handler (fn...)). The handler fn gets the response body stream as soon as it's ready. Then whatever the handler fn *returns* can be retrieved with a function called "result".

13:07 So my question is, should "result" block?

13:07 Chousuke: eldoc seems to be causing nasty lag when moving up and down lines in slime-enabled clojure buffers :(

13:07 I suppose I should disable it.

13:08 Chouser: most simple usage would prefer blocking, though it'd be nice to be able to poll for completion in some more complex use cases.

13:08 Chousuke: stuartsierra: result could be a future?

13:09 stuartsierra: I can still enable polling with a "done?" function or something.

13:09 Chousuke: maybe. I always forget about futures.

13:10 Chousuke: or whatever that new promise/deliver stuff was.

13:11 stuartsierra: I think it needs to block. That makes the simple GET as easy as (string (http-agent "url"))

13:16 Chouser: time for a promise?

13:18 stuartsierra: What's a promise?

13:18 Chouser: hm, undocumented apparently.

13:19 (doc promise) (doc deliver)

13:19 clojurebot: "([]); Experimental. Returns a promise object that can be read with deref/@, and set, once only, with deliver. Calls to deref/@ prior to delivery will block. All subsequent derefs will return the same delivered value without blocking."

13:19 Chouser: clojurebot: oh, you're back! Hi!

13:19 clojurebot: Excuse me?

13:20 stuartsierra: Hm, I don't think I need that yet.

13:21 I just added a "done?" function.

13:28 cemerick: it seems that IDerefs in general need an isReady or isAvailable method, with a corresponding fn in core

13:29 Chouser: 'would-block?'?

13:29 cemerick: well, that's fine enough for promises, etc., but I often would like to know whether a delay has already been forced or not.

13:30 so it's more about whether the thing behind the IDeref is ready to be accessed or not

13:32 stuartsierra: Here it is: http://github.com/richhickey/clojure-contrib/blob/74f64cdea1debc7e2442f9337f28a25a769792d2/src/clojure/contrib/http/agent.clj

13:32 Chouser: hm. For Vars you might want to know if it's got a thread value. For promise if it would block. For delay if it's been forced. For Ref if it's in another transaction. For Atom nothing in particular...

13:33 cemerick: that's stretching it for vars and refs, perhaps :-)

13:34 * stuartsierra goes out to lunch

13:35 Chouser: ok, maybe a bit.

13:35 well, not vars -- that's definitely come up.

13:35 drewr: do you guys know if jdbc connections have issues getting GCed?

13:36 (after they're close()ed, of course)

13:42 cemerick: Chouser: oh, right. That'd be .hasRoot, then?

13:43 drewr: not usually, unless there's a native lib in the background (I think those are called Type II drivers?)

13:43 I remember having GC issues with oracle's type 2 driver...gawd...in 2002? :-|

13:44 drewr: it's a long shot...

13:44 just trying to figure out why this otherwise lazy process I'm doing keeps running out of heap

13:45 cemerick: oh. Well, there's plenty of other reasons why that'd happen that are more probable than a JDBC driver memory leak.

13:45 drewr: I've exhausted all those :-)

13:46 feels that way at least

13:46 Chouser: if a var exists it can have any combination of .isBound and .hasRoot

13:47 if it's bound but has no root, then it has only local binding.

13:47 only thread local

13:47 if it's bound and also hasRoot, it may or may not have thread local binding.

13:49 getThreadBinding isn't public, so I guess you'd have to try set! on it and see if you get an exception, in order to tell apart those last two.

13:50 cemerick: well, whether the binding is thread-local or not is orthogonal to it having any accessible value at all w.r.t. ready/available/etc

13:51 Chouser: I guess my point is I'm not sure there's a single category that is descriptive for all IDeref's

13:51 is a blocking promise the same kind of thing as an unforced delay?

13:53 cemerick: to a fn that doesn't want to wait for any computation behind an IDeref (regardless of its composition), yeah

13:54 LauJensen: Good evening guys. Is it possible when I declare my namespace, to refer all of clojure except println for instance, and refer println henceforth as proonln ?

13:55 Chouser: almost.

13:55 drewr: I agree, proonln is what it should have been called

13:55 LauJensen: It was just an example

13:55 drewr: :-)

13:55 Chouser: you can (ns mine (:refer-clojure :exclude [println]))

13:56 then (defmacro proonln [& args] `(clojure.core/println ~@args))

13:56 I think that's as close as you can get

13:56 oh, no...

13:56 LauJensen: Chouser: But knowing that your first resolution is always a macro, are you sure this is nessarcary ? :)

13:57 Chouser: (def proonln clojure.core/println)

13:57 maybe that

13:57 LauJensen: bingo

13:57 Thanks

13:57 * Chouser whips up a quick macro to do it for you.

13:57 * Chouser then whips up a quiick macro to make writing such macros easier.

14:03 LauJensen: Enter Choujure :)

14:04 * stuartsierra returns

14:04 stuartsierra: And there was much rejoicing.

14:05 LauJensen: Wohoo :)

14:06 weissj: can someone give me a hint on how to get a macro to expand my "args" correctly: (defmacro define-task [name & args#]

14:06 `(defn ~name [& args#] (-> @testscript .getTasks ~(symbol (str "." name)) args#)))

14:07 the problem is i want that last args# to not be a list, but rather the items in the list

14:07 stuartsierra: you don't need the # on args.

14:07 weissj: stuartsierra: ok, but that doesn't solve the other problem right?

14:07 stuartsierra: `(defn ~name [~@args] ...)

14:08 * weissj looks up what ~@ means

14:08 stuartsierra: splicing unquote

14:09 weissj: stuartsierra: yeah i saw that in the reader docs but it doesn't explain what it does

14:09 so i use the splicing unquote in both locations?

14:10 stuartsierra: yes

14:10 * weissj tries it

14:11 weissj: stuartsierra: sweet, thanks! i was going to try some convoluted thing with an anonymous function and apply. glad i don't have to go down that road!

14:11 stuartsierra: welcome

14:32 hiredman: ~ping

14:32 clojurebot: PONG!

14:47 cemerick: how did we get to using markdown for docs? I was trying to search google groups to get the background there, but of course, that was a dead end.... >-8

14:47 stuartsierra: I didn't know we were.

14:48 cemerick: hrm, then I'm really missing some context. What's the markdown references in this thread about "Contrib directory structure", then?

14:48 * stuartsierra reads

14:49 cemerick: oh, nevermind, my mail reader was hiding quoted material from me in a strange way

14:49 * cemerick needs to get back to OS X Mail

14:49 bruceq: Is there a minimal JVM that can run on iPhone?? I want to to use clojure for a new project.

14:49 drewr: I hate mail.app

14:50 cemerick: bruceq: Apple has banned any virtual machines, etc., on the iphone, so I wouldn't hold your breath

14:50 stuartsierra: I think Sean d. is suggesting markdown for library documentation, not docstrings.

14:50 technomancy: bruceq: the JVM is not blessed enough to qualify for approval on that platform according to the high priests of Apple.

14:51 cemerick: drewr: I'm open to suggestions. It's been my main reader for almost 10 years now (yikes!)

14:51 bruceq: I used to work for Apple, so I may have a different view of the political problems. I am looking for a technical solution as a first issue.

14:51 Chouser: bruceq: give us another year or so and we may have a Clojure that compiles to Objective C

14:51 cemerick: bruceq: if you could statically link a native executable (maybe via gcj?), you might get it through

14:52 bruceq: Chouser: Cool. what a bout the Married to JIT issues?

14:52 drewr: cemerick: I wish I had one to give you

14:52 cemerick: drewr: the best of all the bad options, eh?

14:52 weissj: what is the compiler trying to tell me here: java.lang.Exception: Second argument to def must be a Symbol (console.clj:66)

14:52 Chouser: bruceq: not sure -- I guess I wouldn't assume the runtime performance would be stellar

14:53 stuartsierra: weissj: you wrote a (def ...) form the wrong way.

14:53 weissj: the 2nd arg to def doesn't look like it should be a symbol to me

14:53 the *first* arg is a symbol

14:53 stuartsierra: maybe the error message is wrong

14:53 weissj: stuartsierra: yeah, that's what i'm asking. i thought it looked wrong

14:54 and if it's wrong, what is it supposed to be telling me

14:54 cemerick: yeah, runtime optimizations are pretty hard to get around, unless some pervasive/aggressive type-hinting regime were put in place (like what you can do in CL).

14:54 weissj: so that i know what my error is

14:54 stuartsierra: weissj: can't tell you without looking at your code

14:54 bruceq: what about Clojure pumping to LLVM instead of Java JIT? Just a small matter of programming or theoretically a big problem?

14:55 weissj: stuartsierra: i'll assume it meant to say "first arg" and see if that helps me find anything, hang on

14:55 stuartsierra: bruceq: big problem; you'd need to reimplement Java.

14:55 bruceq: LLVM _is_ the future for all Apple infrastructure.

14:55 dnolen_: bruceq: I don't know enough about things to know which way to go, but supporting LLVM sounds like the most likely path.

14:56 cemerick: stuartsierra: is it such a big problem given cinc? Given that, any target platform (javascript, obj c, chicken scheme, etc) "just" has to write the foundations.

14:56 stuartsierra: Yeah, but "just" includes threading, locks, atomic longs, GC, ...

14:56 cemerick: obviously couldn't use any java libs, but you could use js/obj c/chicken libs

14:57 well, targeting anything that doesn't already have GC is definitely a toughie. The rest of it is less onerous, it seems.

14:57 lisppaste8: weissj pasted "untitled" at http://paste.lisp.org/display/85542

14:57 cemerick: (given clojurescript as a baseline counter-example)

14:57 weissj: stuartsierra: ^

14:57 stuartsierra: define-task is a macro, right?

14:58 weissj: stuartsierra: yeah

14:58 bruceq: wondering what rhickey thinks of the porting issues.

14:58 stuartsierra: you can't apply a macro

14:58 weissj: stuartsierra: aw

14:58 crap

14:58 stuartsierra: But you can write another macro that expands into (do (define-task...) (define-task...) ...)

14:58 cemerick: bruceq: lots of the work he's been doing is specifically to enable targeting js, .NET, etc.

14:59 how far that is from LLVM or other lower-level targets is mostly above my pay grade

14:59 weissj: stuartsierra: ok

14:59 cemerick: although I have been turning the idea of a chicken scheme -> C backend over in my head for certain tasks

15:00 * technomancy volunteers for the elisp backend. =)

15:00 technomancy: oh wait, no threads--doh!

15:00 weissj: stuartsierra: that's the function i'm writing so what, i just loop thru my list and do define-task?

15:00 cemerick: technomancy: well, js isn't multithreaded either (AFAIK) *shrug*

15:00 stuartsierra: weissj: Not exactly, you need to write a macro whose *expansion* contains (do (define-task...)...)

15:01 cemerick: the concurrency stuff is very powerful, but the model probably isn't portable to any backend that doesn't have a close corollary to java.util.concurrent

15:01 weissj: stuartsierra: sorry what i mean is i should turn this defn into a defmacro for starters

15:01 stuartsierra: yes

15:01 weissj: ok

15:06 Chouser: technomancy: right, what you want is an elisp frontend. :-)

15:15 lisppaste8: weissj pasted "untitled" at http://paste.lisp.org/display/85543

15:16 weissj: stuartsierra: i wrote this macro ^ but it doesn't expand into anything

15:16 stuartsierra: you're still using defn, not defmacro

15:17 weissj: stuartsierra: haha DUH

15:18 stuartsierra: ok, now i get "java.lang.IllegalStateException: Var clojure.core/unquote is unbound. (NO_SOURCE_FILE:0)"

15:19 stuartsierra: you've got an unquote on get-methods inside the unquote on the map

15:22 weissj: stuartsierra: great, all working now. thanks very much!

15:23 stuartsierra: np

15:28 mebaran151: is it possible to get the bytecode of a an anonymous fn?

15:28 or at least the string representation

15:28 stuartsierra: no

15:29 mebaran151: so nothing like the cool way smalltalk can serialize continuations

15:31 stuartsierra: not at present

15:31 mebaran151: nuts

15:34 Chousuke: you could probably redef defn pretty easily to store the original form in the metadata of the var.

15:36 stuartsierra: That's not going to give you continuations, though.

15:40 LauJensen: Whats the big deal with continuations anyway ?

15:40 I dont think Ive ever missed them in order to overcome any practical obstacle

15:40 stuartsierra: me neither

15:42 mebaran151: I just need the ability to adequately serialize a closure

15:42 continuations are actually kind of like macros

15:42 dnolen_: LauJensen: you can look at clj-cont mebaran, I wrote that a while ago to do just that.

15:42 cemerick: delimited continuations cover at least 90% of the real use cases, and that's pretty straightforward

15:42 dnolen_: it's a port of cl-cont

15:43 mebaran151: you don't really know you can use them until you know you have them

15:43 LauJensen: ~clj-cont

15:43 clojurebot: Huh?

15:43 dnolen_: http://github.com/swannodette/clj-cont/tree/master

15:43 LauJensen: swannodette?

15:43 dnolen_: yeah that's me.

15:43 mebaran151: continuations are very useful for doing backtracking searches

15:44 LauJensen: Depends on how you handle your backtracking

15:44 mebaran151: they're just a useful, succinct way of thinking about it

15:44 they come in handy for AI programming too

15:44 LauJensen: But we could argue all night. The fact of the matter is, ClojureQl will meet all your needs

15:45 mebaran151: what do you mean?

15:45 LauJensen: Nothing - Just doing a little advertising :)

15:45 technomancy: LauJensen: no way man, mire is the best.

15:45 LauJensen: ~clojureql

15:45 clojurebot: clojureql is http://gitorious.org/clojureql

15:45 mebaran151: does clojure ql handle the serialization of arbitrarily nested clojure objects seemlessly?

15:45 LauJensen: I think that speaks for itself my friend :)

15:46 mebaran151: only in theory

15:46 dnolen_: mebaran151: also clojure.zip might be useful for what you are trying to do. that's in core.

15:47 mebaran151: I wrote a serializing backend on top of BerkeleyDB

15:47 it always seemed to me that for languages without explicit types, SQL was a really poor fit

15:49 LauJensen: ClojureQl helps to close that gab a little bit

15:50 cemerick: mebaran151: BTW, I ended up going with jdbm instead of perst, and wrote a lucene Directory implementation on top of it.

15:50 mebaran151: why did you leave perst?

15:50 I checkedout JDBM: it looked it was suffering massive bitrot

15:51 LauJensen: Speaking of bitrot, Chouser hows Clojurescript coming along ?

15:51 cemerick: mebaran151: where did you look at it? There are a couple of definitely-abandoned fork repos out there. The SF svn is very much alive.

15:51 Chouser: LauJensen: dead pending c-in-c

15:51 LauJensen: So sad :(

15:51 mebaran151: cemerick, I might have been misled

15:51 LauJensen: Hows c-in-c coming along ?

15:52 Chouser: LauJensen: Chousuke's almost done with the reader. rhickey's almost done with newnew

15:52 cemerick: anyway, there's lots of chatter about how it's dead, but it definitely does the job pretty well so far.

15:53 mebaran151: looked like the last release was 3006

15:53 *2006

15:53 Chousuke: Chouser: Almost done is an overstatement. It'll just be feature-complete soon. I'll still need to test and very likely optimise it.

15:53 Chouser: and solve the problem it has currently that it might consume more of a stream that it needs to read a single object.

15:53 cemerick: I backed off of perst for a number of reasons. Its lucene directory impl was not exactly first rate, and its reliance on annotations throughout the codebase for various (otherwise very nifty) features was a problem for me.

15:54 mebaran151: sort of scared me off, so I had to go with the excessively over decorated bdb

15:54 yeah

15:54 annotations have ruined many good libraries....

15:54 cemerick: mebaran151: yeah, they're not exactly great with the releases

15:54 Chousuke: Chouser: but those are problems that are easier to solve after I have something that reads strings and produces clojure code.

15:54 cemerick: last checkin was late last year *shrug*

15:54 Chousuke: I don't want to think about streams at this point ;(

15:55 cemerick: the nice thing about it is that it's essentially BSD-licensed, I understand how it works basically top to bottom, and its core storage impl is solid and fast.

15:55 nicely-extensible serialization interface, too

15:56 Once we get through our current project, I'm planning on getting the clojure wrapper for it and the lucene dir impl up on github.

15:56 mebaran151: I could use the lucene dir stuff

15:56 this the library that does arbitrary objects as well?

15:57 with or without serialization support?

15:57 cemerick: no, that's perst. And really, once I saw the impl of it, I was a little scared.

15:57 Serious reflection voodoo.

15:58 very impressive, but I wouldn't count on deserializing such object graphs in a year or whatever.

15:58 mebaran151: yeah

15:58 reflection in Java is a dark art

15:59 did you ever check out tokyocabinet's word indexer

15:59 it's really excessively fast

15:59 cemerick: especially when you see stuff like field.setAccessLevel(PUBLIC), or whatever.

15:59 no. Its lack of windows support is a showstopper for this project.

15:59 mebaran151: oh yeah, I forgot

16:00 qdbm though would have fixed you right up, though in the wake of TC, it's probably as much abandonware as I thought JDBM was

16:00 cemerick: but the speed of jdbm is giving me all sorts of wacky ideas. Like pairing that with JMS or xmpp, and getting a clojure-native couchdb clone. :-P

16:01 yeah. The fact that jdbm is small enough for me to grok in a day was very helpful -- even if the maintainers disappear entirely, I wouldn't be worried.

16:07 mebaran151: jdbm is really that fast?

16:09 also did you check out the internal derby btree implementation

16:09 I bet it's no slouch

16:10 stuartsierra: I've heard Derby can''t compete with dedicated database servers.

16:11 mebaran151: for an embedded db though, paying IPC is pretty bad idea

16:12 cemerick: no, I've not looked at any derby internals

16:13 but I've certainly been impressed enough with jdbm's performance, at least for what I'm doing.

16:14 I've yet to throw big files at it, but in that circumstance, that's just byte arrays, and should be as fast as the disk.

16:14 mebaran151: I think most kv stores tend to be faster than you'd expect

16:14 there's just much less to do

16:15 cemerick: yeah, not having the sql around helps :-)

16:16 LauJensen: cemerick: Did you know that ClojureQL now fully supports Derby, Mysql and psql, without you ever having to write a single sql statement? :)

16:16 cemerick: although I do need to get a decent binary serialization of clojure data structures put together. Java serialization isn't future-proof, and print-dup is guaranteed to be slower than any binary representation.

16:16 LauJensen: I didn't, but then, I don't write any SQL now, either :-)

16:16 LauJensen: (k, just answer yes/no/wow plz)

16:18 cemerick: sorry for ruining your plan ;-)

16:18 stuartsierra: wow

16:18 But I never liked query-generators ever since I found a bug in Rails' MySQL.

16:27 wavister: i'm sure i'm not the first to bring this up, but does anyone else find this a little wrong?

16:27 ,(keyword (str :map-key))

16:27 clojurebot: ::map-key

16:28 Chouser: ,(keyword (name :map-key))

16:28 clojurebot: :map-key

16:28 wavister: glorious!

16:28 wtetzner: that's because (str :map-key) returns ":map-key"

16:28 wavister: wtetzner: i know...

16:28 Chouser: I don't think you'd want (str :foo) to return just "foo" most of the time

16:31 stuartsierra: frequently, I do, but I agree it would be counter-intuitive

17:12 weissj: how does one submit bugs against clojure? i found a minor one today (an exception message needs fixing to be accurate)

17:14 hiredman: http://www.assembla.com/spaces/clojure/support/tickets

17:15 LauJensen: weissj: is it the infamous "NO MESSAGE" message? :)

17:15 Chousuke: Hmm.

17:16 I wonder how I ever could edit lisp without paredit before. this is awesome.

17:16 weissj: LauJensen: no, the message is "java.lang.Exception: Second argument to def must be a Symbol", but it is the *first* arg to def that needs to be a symbol.

17:16 LauJensen: aha

17:16 weissj: whoever wrote it was counting the symbol "def" as the first arg to def :)

17:17 Chousuke: ,#(%20)

17:17 clojurebot: #<sandbox$eval__2029$fn__2031 sandbox$eval__2029$fn__2031@7673a2>

17:17 Chousuke: ,#(%21)

17:17 clojurebot: java.lang.Exception: Can't specify more than 20 params

17:20 LauJensen: Chousuke: In Emacs you can have an interactive repl, so youre not dependant on Clojurebot, how does that sound? :)

17:23 Chousuke: LauJensen: sure. was too lazy to switch back to emacs window :P

17:28 osaunders_: ~seen hiredman

17:28 clojurebot: hiredman was last seen in #clojure, 14 minutes ago saying: http://www.assembla.com/spaces/clojure/support/tickets

17:34 hiredman: I am sort of around

17:34 osaunders_: It's OK. I don't need you. :-)

17:34 I saw clojurebot was back so I wondered if you were too.

17:34 Oh and hi!

17:35 drewr: switched from doseq to dorun/map and lo, no more heap blowage

17:35 Chouser: uh oh

17:36 drewr: you don't have to have a small self-contained example, do you?

17:36 mebaran151: isnt' doseq a simple macro around loop?

17:36 I would think map would be more likely to blow the heap

17:36 Chouser: drewr: and/or try the new chunk-enabled doseq

17:37 drewr: http://www.assembla.com/spaces/clojure/documents/ayZsEAIHer3OuReJe5afGb

17:38 hiredman: doesn't doseq also contain some for style stuff these days?

17:38 drewr: Chouser: I've got chunks in this build, but it doesn't look like doseq is using them directly

17:38 weissj: how do i get a symbol for the current namespace *ns* ?

17:38 Chouser: drewr: no, the chunking doseq isn't checked in. I just finished it on Saturday

17:38 weissj: i am trying to write a macro "with-ns" that does stuff within a namespace and then leaves you in the ns where you were before

17:39 Chouser: ,(.name *ns*)

17:39 clojurebot: sandbox

17:39 Chouser: weissj: that's going to be hard since a bunch of what relies on the vvalue of *ns* happens at compile time

17:40 hiredman: weissj: most ns functions will accept a namespace object or a symbol naming a namespace

17:41 weissj: Chouser: yeah but i'm not evaluating ns at compile time

17:41 *ns* rather

17:41 or maybe i don't understand you

17:42 Chouser: ,(read-string "`foo")

17:42 clojurebot: (quote sandbox/foo)

17:42 Chouser: weissj: I'm not sure what you're doing, just pointing out an area of complexity that may (or may not) cause you problems.

17:42 weissj: Chouser: i think i see what you're saying, but i think it's still going to work for my purposes

17:42 hiredman: weissj: def relies on the compile time value of *ns* for example

17:43 weissj: even at compile time, i want a bunch of stuff def'd in *another* namespace

17:43 not the current one

17:43 drewr: Chouser: I've been trying various ways of isolating the problem with no luck

17:43 hiredman: you need to use intern

17:43 weissj: ie, my code creates some functions in a separate ns

17:43 hiredman: weissj: it won't

17:44 weissj: hiredman: oh yeah i recall seeing intern

17:44 hiredman: the code that creates functions is not run at compile time

17:44 it is just compiled

17:44 (hence compile time)

17:44 weissj: hiredman: so what are you saying that it's compiled with some *ns* value hard-coded?

17:45 hiredman: weissj: any def uses the compile time value of *ns*

17:45 so defn, etc

17:45 so you have to use intern

17:46 weissj: hiredman: hm ok, i think i can make that work. the 'with-ns' macro i had in mind sounded more intuitive, but if it won't work, so be it.

17:47 hiredman: it will, just not for def

17:47 I think this is a with-ns in contrib

17:47 ,(doc with-ns)

17:47 clojurebot: "clojure.contrib.with-ns/with-ns;[[ns & body]]; Evaluates body in another namespace. ns is either a namespace object or a symbol. This makes it possible to define functions in namespaces other than the current one."

17:47 osaunders_: Does anybody know any good talks online about the multi-core CPU problem and why single cores aren't getting faster?

17:48 hiredman: ~def with-ns

17:49 oh

17:49 disgusting

17:49 a macro that emits calls to eval

17:52 d2dchat: BTW just release my codebase for my first ever clojure project

17:53 http://github.com/lancecarlson/eugene/tree/master

17:53 feedback appreciated :)

17:55 tomoj: eugenics, huh?

17:55 hiredman: "Eugenics framework in clojure" sounds ominous

17:55 clojurebot: "[Clojure ...] feels like a general-purpose language beamed back from the near future."

17:57 d2dchat: Eu = Good

17:57 Genics implies Genetics

17:57 I was a little bit worried about menacing connotations hehe

17:58 was better than Genocide framework

17:59 the problem with the word Eugenics is that it is too commonly associated with humans..

17:59 I think that that's false

17:59 it should be applied to all organisms.. as it has been practiced on others

17:59 it only happens to be morally repugnant when it's humans

18:00 tomoj: hmm

18:01 m3lling: Anyone know why I get an error "Don't know how to create ISeq from: Def" ... on this blog http://blog.thinkrelevance.com/2008/9/16/pcl-clojure-chapter-3

18:01 I copy the first few lines down to the dump-db

18:01 (init-db)

18:01 (dump-db cd)

18:01 tomoj: genetics is from genesis, but eugenics is from eugenes<-genos

18:01 wavister: i think it's highly appropriate, and the sci fi connotations make the name memorable. plus in the near[er] future i might be needing to do some evolution for interface purposes

18:01 m3lling: then error...

18:02 d2dchat: tomoj: ah I just thought Eugene was a cute name that happened to look a lot like Eugenics lol

18:02 tomoj: eugene is also from eugenes

18:03 though eugenes could be applied to animals too, I thought it was always a person

18:04 d2dchat: I think Eugenics can be applied to anything that you can give "genetic code"

18:04 so programs too

18:04 tomoj: perhaps it _should_ be that way

18:04 but as it stands eugenics is specifically about humans :/

18:05 d2dchat: Can one challenge that notion?

18:05 tomoj: sure but good luck being understood :)

18:05 d2dchat: hehe

18:05 tomoj: huh, actually it appears eugenics can be any race/breed

18:05 d2dchat: Point taken

18:05 tomoj: but most people just think of humans I guess

18:06 d2dchat: is this better? ominous

18:06 whoops

18:06 Evolve your programs! Eugenics applied to software.

18:10 wavister: maybe we'll finally have a race of futuristic supermen to design software for

18:10 http://www.codinghorror.com/blog/archives/000821.html

18:10 hiredman: d2dchat: I think it is fine

18:17 d2dchat: wavister: That's my target audience :)

18:39 weissj: if i want to define some other namespaces in one file, how do i give them a shorter alias for use in just this file?

18:39 i don't think i can use require, because i don't need to load anything

18:40 Chousuke: define other namespaces? :/

18:40 you can use create-ns

18:40 hiredman: weissj: I would checkout the namespace section on the clojure website

18:42 fsm: Hello all, question time - is there a lazy equivalent to let? I have some speed-sensitive code that currently has nested if and let statements that seems a little clunky.

18:43 I could take out all that stuff if i knew expensive calculations would only be done if a name was referenced

18:43 at the moment, i do it by creating functions that return the values that i want, but a function call is also expensive.

18:44 hiredman: the only thing "lazy" in clojure are the lazy sequences

18:45 fsm: are there any standard idioms used to get around this clunky procedural stuff?

18:46 hiredman: -> and doto

18:47 fsm: basically, a lot of graphics code gets its performance from testing values and dropping out of the routine as soon as possible, to avoid unused calculations

18:48 it would be very elegant just to declare all the names, and have the algorithm follow, like describing a math equation on paper

18:49 hiredman: ,(doc promise)

18:49 clojurebot: "([]); Experimental. Returns a promise object that can be read with deref/@, and set, once only, with deliver. Calls to deref/@ prior to delivery will block. All subsequent derefs will return the same delivered value without blocking."

18:50 weissj: i am still having some trouble here, i just want to use "require blah :as b" but the namespace blah isn't a lib in a different file, it's just a namespace.

18:50 hiredman: so?

18:51 weissj: hiredman: so, i can't figure out how. refer doesn't appear to take an ":as"?

18:51 hiredman: weissj: http://clojure.org/namespaces

18:51 weissj: hiredman: yeah i am looking at that

18:51 hiredman: http://clojure.org/api#alias

18:52 weissj: "Add an alias in the current namespace to another namespace"

18:52 hiredman: well?

18:52 weissj: maybe that's ambiguous, but sounds like you are linking from another namespace to the current one, which is the opposite of what i want

18:53 hiredman:

18:53 weissj: i want to define an alias in the current namespace, that points to another one

18:53 hiredman: which is exactly what alias does

18:53 weissj: oh. then the doc did not make sense to me :)

18:53 hiredman: it creates a namespace in the current namespace to another namespace

18:53 er

18:53 alias

18:54 weissj: it's is saying "add to another namespace an alias in the current namespace". i do not want to add anything to the other namespace.

18:55 hiredman:

18:55 it doesn't

18:55 "in the current namespace"

18:56 weissj: add what to what? Add "an alias in the current namespace" TO "another namespace". that's how i read it.

18:56 it's poorly worded, IMO :) or maybe i'm just dumb

18:56 hiredman: Add an alias, in the current namespace, to another namespace

18:57 weissj: it's ambiguous.

18:57 is it an alias TO something, or are you adding something TO something

18:57 it's not clear what the TO belongs to

18:57 wavister: perhaps it should say "add to the current namespace an alias to another namespace"

18:58 weissj: wavister: yeah

18:58 hiredman: it is not ambiguous

18:58 bitbckt: It it awkward, but not ambiguous.

18:58 is*

18:59 weissj: it IS ambiguous. meaning 1: Add (an alias in the current namespace) to (another namespace)

18:59 wavister: "plain" english has problems

18:59 weissj: meaning 2: Add (an alias) (to another namespace) (in the current namespace)

19:00 bitbckt: weissj: I would grant you (1), if the first clause read "an alias *to*..."

19:01 weissj: bitbckt: (1) is literally what it says.

19:01 (2) is the intended meaning

19:02 "to another namespace" either is a modifier for "alias in the currrent namespace" OR the the destination of the Add

19:02 anyway, i misread it, thanks for decoding it for me :)

19:03 bitbckt: Clearly.

19:33 lowlycoder: anyone have identation not work in vimclojure? (it looks like garbage)

20:34 m3lling: I got this "CD db" example working http://blog.thinkrelevance.com/2008/9/16/pcl-clojure-chapter-3

20:34 but at the end I want to save-db and load-db

20:34 the save dumps the data in the proper format to a file called db.txt

20:35 then I try (load-db "db.txt" and I get an error.

20:35 ArrayIndexOut of bounds.

20:35 (def xx (load-db "db.txt"))

20:44 osaunders: How is everyone doing?

20:48 m3lling: no one is here.

22:14 konr: what book do you recommend me on distributed systems? Tannenbaum?

Logging service provided by n01se.net