#clojure logs

2009-08-17

00:00JAS415god
00:00JAS415i hate java
00:01JAS415there really has to be 10 types of image?
00:01JAS415all which are incompatible and have to be transformed in some sort of abstract voodoo?
00:01JAS415and once you transform them they don't even work but come up as blank images
00:02JAS415i've fought with this all day and it doesn't even display properly!
00:02JAS415wtf.
00:02JAS415i could have implemented my own image library in this time or something
00:42cemerickJAS415: is there a much better imaging library elsewhere? JAI is pretty darn spiffy these days. I remember hating the stuff in python, FWIW.
00:42JAS415JAI?
00:43JAS415i'm trying to use the builtins and i just can't make it work
00:43cemerickjava advanced imaging
00:43JAS415i'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
00:44JAS415it seems like simple stuff, but i'm just too incompetent i guess
00:45JAS415so either
00:45JAS415i end up throwing an exception that is basically meaningless
00:45JAS415'invalid argument to native writeImage'
00:45JAS415or 1/2 of the images come up empty
00:46JAS415honestly is driving me nuts
00:46cemerickJAS415: 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)
00:46cemerickYou need a buffered image, but that's pretty straightforward (and chances are, the image you have is already a bufferedimage)
00:47JAS415yeah i have one
00:47JAS415in fact i'm using that
00:47JAS415i'm using exactly that
00:47JAS415i've had it writing to file
00:47JAS415its just that like
00:48JAS415sometimes it works sometimes it doesn't
00:48JAS415its completely hit or miss
00:48cemerickwell, then you've got some images with oddball ColorModels and such
00:48cemerickwe did some testing of the .NET libs, and they have much weaker support for such ColorModels than java's image libraries, FWIW
00:49cemerickwe 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.
00:50JAS415i don't even know about color models
00:50JAS415all i'm doing is getting images from a url
00:51JAS415converting them to buffered
00:51JAS415and writing to file
00:51JAS415i'm just freaking exhausted at this point
00:51cemerickhow are you converting them to BufferedImages?
00:51JAS415(defn to-buffered-image [image]
00:51JAS415 (let [b (new BufferedImage (.getWidth image) (.getHeight image) BufferedImage/TYPE_INT_ARGB)
00:51JAS415 g (.createGraphics b)]
00:51JAS415 (.drawImage g image (new java.awt.geom.AffineTransform) nil)
00:51JAS415 b))
00:52JAS415that didn't work well
00:52cemerickright. If the image doesn't have a color model compatible with ARGB, then you won't be happy
00:53cemerickis the raw Image you get from the URL load not a BufferedImage already?
00:53JAS415hold on i'll put it on lisppaste
00:54lisppaste8Jon pasted "I can't get this to work.." at http://paste.lisp.org/display/85501
00:54JAS415granted I had it moderately working before
00:54JAS415and now it is just not working at all
00:55cemerickand your overall objective is?
00:55JAS415ok
00:56JAS415access image, convert to buffered image, cache on disk, display as imageicon
00:56JAS415later, retrieve from disk instead of going out to the web
00:56cemerickwhy convert it to a buffered image? Is it not already one when you get it back from the toolkit?
00:57JAS415it is a ToolkitImage
00:57JAS415which is not a buffered Image
00:58JAS415so
00:58JAS415you can't save a toolkit image to disk
00:58JAS415but you can save a bufferedimage to disk
00:58JAS415i think
00:59cemerickI'd use ImageIO.read to get the URL's image data (once you have an inputstream to it), rather than toolkit
00:59JAS415hmm
00:59cemerickthen you're always working with buffered images
00:59JAS415good point
00:59JAS415I will do try to do that
01:00cemerickI 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.
01:00cemerickgood luck :-)
01:00JAS415thanks :-)
01:06Knekkis there a way I can override the symbol's print representation? i.e. (println `+) => + and not clojure.core/+ ?
01:21arbschtKnekk: syntax-quote will resolve the symbol. (println '+) might achieve what you want; or generally (name '+)
02:42lowlycoderhey,
02:42lowlycodersorry for wasting a line
02:42lowlycoderhow do i get clojure to print out the clss path for me?
02:42lowlycoder(.System (.Property)) is printing out too much shit
02:42lowlycodererr, sorry for language
02:45tomoj(System/getProperty "java.class.path") ?
02:46lowlycodercool; thanks
02:46lowlycoderokay, 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
02:46tomojwhat's (.System (.Property))?
02:46tomojthat doesn't make sense to me
02:47lowlycoderand 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:
02:47lowlycoder#<CompilerException java.lang.NoClassDefFoundError: Could not initialize class com.sun.opengl.impl.x11.X11GLDrawableFactory (opengl-gears.clj:0)>
02:47lowlycoderthe above is me being stupid since im learning clojure
02:50arbschtwhat's in opengl-gears.clj?
03:00lowlycoder(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"
03:01lowlycoder/usr/share/java/jogl.jar contains: com/sun/opengl/impl/x11/X11GLDrawableFactory.class
03:01lowlycoderyet when I try to do: (import '(com.sun.opengl.impl.x11 X11GLDrawableFactory))
03:01lowlycoderi get an error of: #<CompilerException java.lang.NoClassDefFoundError: Could not initialize class com.sun.opengl.impl.x11.X11GLDrawableFactory (test.clj:0)>
03:01lowlycoderwhat's going on?
03:06hiredmanclojurebot: how many things do you know?
03:06clojurebotI don't understand.
03:06hiredmanclojurebot: how much do you know?
03:06clojurebotI know 337 things
03:07hiredmancrap
03:07hiredmansorry
03:30lowlycoderwhat's the equiv of: "import java.awt.*" ?
03:31Fossilowlycoder: there's none
03:32tomojyay clojurebot is back
03:32Fossiafaik at least
03:32lowlycoderso i have to load them one by one?
03:40tomojyou have to import whichever classes you want to refer to by a short name
04:10lowlycoderhow do I connect to a cojure server, see what all the active threads are
04:10lowlycoderand then selectively kill them?
04:11lowlycodererr sorry, let me rephrase that
04:11lowlycoderi'm at a clojure repl
04:11lowlycoderhow do I get a list of all active java threads
04:11lowlycoderand then kill them
04:19arbschtwahey, clojurebot :)
04:32arbschtlowlycoder: something like this can get you a seq of threads http://gist.github.com/168997
04:33lowlycoderwhoa, did you write that just for me?
04:33MidKnighttesting...
04:33arbschtsure, just a quick proof of concept
04:34lowlycoderso 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(/127.0.0.1, 2113),5,main]> #<Thread Thread[DestroyJavaVM,5,main]> #<NGSession Thread[NGSession 1: (idle),5,main]> #<NGSession Thread[NGSession 2: 127.0.0.1: de.kotka.vimclojure.nails.Repl,5,main]> #<Thr
04:34MidKnightHey everyone, I am brand new to Clojure
04:34lowlycodererr, sorry
04:34lowlycoderplease don't kick ban
04:34lowlycoderdid not mean to paste that much
04:35arbschtthe point is clojure threads are just java threads; you can play with them via the java api
04:35lowlycoderhttp://paste.lisp.org/display/85505
04:35lowlycodersorry for dumb question
04:35lowlycoderhow do I ask it to kill all the ones named de.kotka.vimclojure.nails.* ?
04:36lowlycoderwait, that's actually not all that I want to kill
04:36lowlycoderhmm
04:36Fossihi MidKnight
04:36arbschtideally, you wouldn't... Thread/stop is deprecated
04:37lowlycoderso what should I be doing isntead?
04:38MidKnightHi fossi
04:39arbschtspawn threads which check for a signal to live or die, for example. the java docs describe this in detail
04:39arbschthttp://java.sun.com/javase/6/docs/technotes/guides/concurrency/threadPrimitiveDeprecation.html
04:39lowlycoderarbscht: which java docs? (sorry, i'm new to java)
04:39lowlycodernice; thanks
04:41lowlycoder private volatile Thread blinker;
04:41lowlycoder public void stop() {
04:41lowlycoder blinker = null;
04:41lowlycoder }
04:41lowlycoderwtf? have it garbage collected?
04:41lowlycoderis that the idea?
04:42lowlycoderno wait; that's not how it works
04:42lowlycoderwhy does blinker have to be volatile?
04:42lowlycoderbecause it can change between threads?
04:45arbschtvolatile 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
04:46lowlycoderis Thread/stop is deprecated; and I write a runaway thread; how do I kill it?
04:47AWizzArdSun suggests that the thread itself should check for the state of some var as a signal to just stop.
04:47lowlycoderright; but if I screw up on that; there's no way to fix it?
04:47lowlycodersuppose i'm running this mission criticial jvm that can't be taken down
04:48arbschtI 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 :)
04:48lowlycoderand some newb intern throws on their a thread that just while(1) { allocate lots of crap}
04:48lowlycoderit just eats up the jvm ram?
04:49arbschtif it's mission critical, do you want to risk corrupting its state? you might kill the thread but you can't trust its state
04:49AWizzArdIn 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
04:52lowlycoderokay, so i'm using vimclojure
04:53lowlycoderwhat's the easiest way to leat each "reloadfile" kill the previous one
04:53lowlycoderhmm, this question is poorly asked
05:21ole3hello i like to split my project into different files, where do i put the package description (e.g. ns) ?
05:25Chousukeole3: the ns declaration should be in the file that corresponds to the namespace.
05:26Chousukeole3: to split your project, you can either have multiple namespaces, or use load-file
05:32ole3Chousuke: like: project.clj: (ns project (:import (java.io File FileInputStream))) (load-file "file1.clj") (load-file "file2.clj")
05:33Chousukeyeah. though usually your ns declaration should have at least two parts.
05:36ole3Chousuke: What parts?
05:36Chousukeas in. ole3.project
05:36Chousukeand then put the code in ole3/project.clj
05:36ole3ah, ok thank you
05:37Chousukeand add the directory where ole3/ is to classpath
05:38ole3ok
05:40ole3Is it ok to mix java and clj in a directory tree, or should they keep in seperate trees?
05:46Fossii guess it would be okay, but uncommon
05:47Fossito me it would signal a pretty strong dependency
06:05rottcoddhow can I check if an object is a java array?
06:20y-combinatorHello, im running Clojure on Mac with Java version "$ java -version
06:20y-combinatorjava version "1.6.0_13"
06:20y-combinatorJava(TM) SE Runtime Environment (build 1.6.0_13-b03-211)
06:20y-combinatorJava 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?
06:21rsynnottwhat sort of errors are you getting?
06:21rsynnottwas the colleague using Java1.5 or 1.6?
06:22y-combinatorsome random problems with classpath
06:22y-combinatorhe is used latest version of java 1.6 from Sun
06:22y-combinator$ ant
06:22y-combinatorBuildfile: build.xml
06:22y-combinatordef-tasks:
06:22y-combinatorBUILD FAILED
06:22y-combinatorjava.lang.ExceptionInInitializerError
06:22y-combinator at java.lang.Class.forName0(Native Method)
06:22y-combinator at java.lang.Class.forName(Class.java:242)
06:22y-combinator at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:583)
06:22y-combinator at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:228)
06:22y-combinator at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
06:30y-combinatorok, solved by running ant with "-noclasspath"
08:13cemerickholy crap, git-bisect is wonderful
08:14Chouserwhen you need it, it's exactly what you need.
08:14Chousukeheh.
08:15Chousukeit does require some discipline in your commits to have git-bisect work well, though.
08:15cemerickChousuke: how so?
08:15Chousukeif some commit breaks your build. it'll make git bisect less useful.
08:16arbschtChouser: as bad as ,expr failing? the channel felt empty without clojurebot
08:16cemerickah, right
08:16Chousukeyou'll skip the broken commit of course, but then you might end up with the wrong commit being blamed for breakage :/
08:16Fossiwell, at least you can have local commits in git that don't show up in the blessed repo
08:16Fossiunlike hg
08:16cemerickseems like that makes rebase even more important, so that interim commits don't ever make it into an authoritative repo
08:17Chousukeyeah, squashing "oops" commits is a nice way to keep development history clean
08:18cemerickstuff like this keeps reminding me that I made the right decision on git vs. hg :-P
08:20ChousukeI 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.
08:22cemerickwell, there's no rebase in hg. That was my biggest issue with it.
08:54ole3hi, now my little project is working, but how do i create an executable?
08:55Chousukeyou usually don't. but you can make it a jar.
08:55ole3why not?
08:56Chousukewell, java projects are usually distributed as jars
08:56carkhum i usually do =)
08:56carkahyes an executable jar yes
08:56Chousukebut I have to say I have no idea how to make jars myself :P
08:56ole3executable jar? a script?
08:57carkyou know, a jar that can be started easily like this : java -jar myjar.jar
08:57hamzahey 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?
08:58ole3ok, so i need to generate class files somehow
08:58carkole3 : you could do without it, but yes you can do class file generation, AOT compilation
08:58Chousukehttp://asymmetrical-view.com/2009/06/22/executable-clojure-jars.html
08:58cemerickole3: not necessarily
08:58cemerickor, http://www.google.com/search?q=executable+jars </snarky>
08:59Chousukesome of the google hits are obsolete information though.
08:59Chousukehaving references to gen-and-save-class :|
09:00carkole3 : it takes a bit of research to have a good build process ...
09:00carkhamza : declare your ref from a file that will be imported from both files
09:01Chousukeole3: the clojure unit of compilation is a namespace.
09:01carkfrom/if
09:01carkof =/
09:01carkdamn i need coffee =)
09:01Chousukeole3: so if you have a namespace in your classpath, (compile 'your.namespace) will compile it
09:01ole3ok, but a source file needs the jna library so compile failed
09:02ole3but jna.jar is in the classpath
09:02Chousukehmm
09:03Chouseryou don't really need to compile -- for your jar to be stand-alone you'll have to include most of Clojure anyway
09:04Chousukeyeah. it'll probably be easier to just put your .clj files in there
09:04Chouserjust 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.
09:04Chouserhm. I guess I usually genclass a main menthod. :-/
09:04ole3ok, i will try that, thanks
09:05ChouserI wonder if you can provide command-line args in the manifest so that you can use clojure.main as your jar's main.
09:05carksomeone should do a nice writeup on how to do the full build process
09:05carktoo bad i don't have a blog
09:07ole3clojure application delivery is like common lisp application deliver :)
09:07Chouseroh, really? CL want's you to write ant scripts in XML too?
09:07Chouser:-) :-)
09:07carki do it more like c ... using ant as make
09:08Chousukedealing with jars and clojure is a bit painful still I guess.
09:08carkthe pain comes from ant
09:08carki really can't stand xml
09:08Chousukebut I suppose that'll get better as Clojure matures.
09:09ChousukeXML itself is not horrible, but the way ant uses it is :(
09:09carkwell as soon as the xml file is more than a page long, it becomes unreadable
09:09cemerickneither ant nor jars are particularly difficult....
09:10carkcemerick : difficult to read
09:10carkthat's write only stuff
09:10cemerickthe clojure buildfile itself produces an executable jar in about 12 lines *shrug*
09:11carkright, but you might want to have libs automatically added for instance
09:11carkthen make nice zip
09:11cemerickfrom contrib, you mean?
09:11carkall the libs for your application
09:11cemericklisppaste8: url?
09:11lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
09:13lisppaste8cemerick pasted "seriously, producing jars containing your clojure code and others' libs isn't hard..." at http://paste.lisp.org/display/85515
09:13carkthat's part of it
09:13cemerickbesides that, there's nothing stopping anyone from using make, rake, etc etc
09:13lisppaste8cark pasted "there is more to it" at http://paste.lisp.org/display/85516
09:14Neronusor custom binary executables
09:14carkit takes a while to have someting that works ...anyways i'm past that so i don't care =D
09:14cemerickcark: I think you just described *all* build processes/tools ;-)
09:15carkhehe you might be right indeed
09:15carki just which we would have some neat stuff in clojure
09:15carkwith all the capabilities of ant
09:15cemerickyeah, I was just about to say that
09:16carkmy understanding was that lancet was a wrapper around ant ?
09:16Chousera wrapper that avoids the xml I believe
09:17cemerickI don't know if avoiding XML is the biggest issue with build processes.
09:17cemerickI 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:06ole3ok, now I have two directories lib and src.
10:06ole3In lib is clojure.jar and jna.jar
10:06ole3in src is com/etc/projects/....
10:07ole3and i have a shell script starting the clojure repl and loading the project.
10:07ole3Thanks for your help.
10:48weissjcemerick: 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:08cemerickweissj: yeah, I'll take a look at it eventually. It's hard to justify spending time on build processes that work, though. :-)
11:41Chouser(.toCharArray (build-string "foo" "bar"):String) ?
11:42Chouser(defn build-string:String [& args] ...) ?
11:44ChousukeChouser: hmm.
11:45ChouserChousuke: exactly.
11:45Chousercemerick: any thoughts?
11:46stuartsierraThe former would complicate the reader. The latter looks like :String is part of the name.
11:46ChousukeI wonder if I should implement #() as a macro for my reader.
11:46cemerickChouser: yeah, call-site hinting requires a reader change
11:46Chousukehaving it expand to (auto-fn ...)
11:46Chouserright, but would those forms even be desirable?
11:47cemerickah, that's a different question :-)
11:47cemerickI thought you were trying to use the defh or something.
11:47Chousukethen I could possibly allow nested #()s
11:47Chousukehmm.)
11:48ChouserChousuke: #() were originally allowed.
11:48Chouserer nested #() were originally allowed
11:48cemerickChouser: well, that's worth discussing. I *think* so.
11:48ChousukeI'm running out of features to implement for my reader
11:48ChouserChousuke: cool!
11:49Chousukesoon I will have to start worrying about the metadata stuff
11:49cemerickThe #^Blah hieroglyphics are a wart, IMO, and they don't get better with age and more usage.
11:50ChouserThey're visually messy, but semanticly clean.
11:50ChouserI'm worried foo:Type reverses that.
11:50Chouserfoo:{:other :meta-data} ??
11:51ChousukeI already have strings, numbers, basic symbol parsing, regex patterns, lists, maps sets and vectors
11:51Chousukeof the more complicated reader macros, I'm missing #< and #= :/
11:51cemerickwell, I'm definitely not suggesting foo:Blah as a generalized replacement for metadata -- just sugar for type hinting
11:52cemerickMaybe that means it's useful binding forms, but not at call-sites.
11:52cemerick(given hinting the latter is generally less common?)
11:53NeronusWhat do #< and #= do?
11:53ChousukeI think #<foo> is "fail!" and #= is read-time eval.
11:54NeronusTo the first.. d'oh of course, to the second: nice
11:54Chousukebut I need to double-check their semantics :P
11:54Neronusthank you
11:54ChousukeClojure uses #<> to print out unreadable things.
11:56Neronusyeah, like CL does
11:57Neronussometimes I wish regexps were callable like sets are, so that i could do (filter #"foo" seq)
11:58Chousukethat's unfortunately not possible until Clojure starts doing interface injection :P
11:58Chousukewhich would be cool, but might never happen :(
12:01stuartsierraIs anyone actually using clojure.contrib.http.apent?
12:01NeronusWouldn't it be possible to just subclass java.util.regex.Pattern, and make that class implement IFn?
12:01stuartsierraNeronus: no, Pattern is final.
12:01Neronusaw, that sucks
12:01Neronusthanks anyway
12:03Chouser(defn re-seqer [r] (partial re-seq r)) might be interesting to play with.
12:05ChousukeHm, I think I'll get a cup of coffee and see how quickly I can implement keyword reading support.
12:15drewrstuartsierra: I'm using it, but you knew that
12:16AWizzArd~seen rhickey
12:16clojurebotno, I have not seen rhickey
12:16Chousukehmm, 10 minutes. not bad :P
12:16AWizzArd~seen Chousuke
12:16clojurebotChousuke was last seen in #clojure, 0 minutes ago saying: hmm, 10 minutes. not bad :P
12:16AWizzArd~seen kotarak
12:16clojurebotno, I have not seen kotarak
12:17Chousukeooh, when did clojurebot return?
12:17Chousukeclojurebot: botsnack
12:17clojurebotthanks; that was delicious. (nom nom nom)
12:18stuartsierradrewr: I'm working on an improved interface: https://www.assembla.com/spaces/clojure-contrib/tickets/15-Streamline-clojure-contrib-http-agent-interface
12:18drewrI think I like those ideas
12:19drewralthough I'm only using response-body-str atm
12:19drewrfrom a POST
12:19stuartsierraright, so I want to simplify that common case, probably to simply "string".
12:21drewrI created what amounts to a (result-str URL PAYLOAD) for my use
12:21stuartsierraok
12:21stuartsierraNext step is a higher level interface with functions like get/post/put.
12:21stuartsierraBut that will be a separate lib.
12:22drewrI can envision some multimethods for different content-types
12:23drewrwhen PAYLOAD is xml, set content-type header to application/xml etc.
12:23stuartsierraYeah, I'm not sure how to handle that yet.
12:23stuartsierrae.g., How do you recognize XML if it's generated as a String?
12:24drewryou wouldn't have to make it that smart, but you could require a <?xml...> declaration first or something
12:28stuartsierraSounds a little too magical to me. But it could dispatch on a keyword, like :xml, :text, :json.
12:28drewryep
12:29JAS415~seen AWizzArd
12:29clojurebotAWizzArd was last seen in #clojure, 12 minutes ago saying: ~seen kotarak
12:53stuartsierraCan HTTP response headers ever contain spaces?
12:56drewrstuartsierra: where?
12:56drewrkeys? values?
12:56stuartsierraIn the field name, the key.
12:56drewrI would guess that even if it's allowed, it's not recommended; I've never seen a space there
12:57stuartsierraIf I'm reading the spec right, it's not allowed. Good, that means I can use keywords as header names.
13:04stuartsierraShould the response body methods block until the response is completed?
13:04stuartsierra(Right now they return nil if the HTTP request hasn't completed.)
13:04Chousernot if you can start reading the head of the stream before the tail is done.
13:05stuartsierraThat's already allowed by passing a handler function when you start the request.
13:06Chousukehm
13:06stuartsierraBasically, 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:07stuartsierraSo my question is, should "result" block?
13:07Chousukeeldoc seems to be causing nasty lag when moving up and down lines in slime-enabled clojure buffers :(
13:07ChousukeI suppose I should disable it.
13:08Chousermost simple usage would prefer blocking, though it'd be nice to be able to poll for completion in some more complex use cases.
13:08Chousukestuartsierra: result could be a future?
13:09stuartsierraI can still enable polling with a "done?" function or something.
13:09stuartsierraChousuke: maybe. I always forget about futures.
13:10Chousukeor whatever that new promise/deliver stuff was.
13:11stuartsierraI think it needs to block. That makes the simple GET as easy as (string (http-agent "url"))
13:16Chousertime for a promise?
13:18stuartsierraWhat's a promise?
13:18Chouserhm, undocumented apparently.
13:19Chouser(doc promise) (doc deliver)
13:19clojurebot"([]); 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:19Chouserclojurebot: oh, you're back! Hi!
13:19clojurebotExcuse me?
13:20stuartsierraHm, I don't think I need that yet.
13:21stuartsierraI just added a "done?" function.
13:28cemerickit seems that IDerefs in general need an isReady or isAvailable method, with a corresponding fn in core
13:29Chouser'would-block?'?
13:29cemerickwell, that's fine enough for promises, etc., but I often would like to know whether a delay has already been forced or not.
13:30cemerickso it's more about whether the thing behind the IDeref is ready to be accessed or not
13:32stuartsierraHere it is: http://github.com/richhickey/clojure-contrib/blob/74f64cdea1debc7e2442f9337f28a25a769792d2/src/clojure/contrib/http/agent.clj
13:32Chouserhm. 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:33cemerickthat's stretching it for vars and refs, perhaps :-)
13:35Chouserok, maybe a bit.
13:35Chouserwell, not vars -- that's definitely come up.
13:35drewrdo you guys know if jdbc connections have issues getting GCed?
13:36drewr(after they're close()ed, of course)
13:42cemerickChouser: oh, right. That'd be .hasRoot, then?
13:43cemerickdrewr: not usually, unless there's a native lib in the background (I think those are called Type II drivers?)
13:43cemerickI remember having GC issues with oracle's type 2 driver...gawd...in 2002? :-|
13:44drewrit's a long shot...
13:44drewrjust trying to figure out why this otherwise lazy process I'm doing keeps running out of heap
13:45cemerickoh. Well, there's plenty of other reasons why that'd happen that are more probable than a JDBC driver memory leak.
13:45drewrI've exhausted all those :-)
13:46drewrfeels that way at least
13:46Chouserif a var exists it can have any combination of .isBound and .hasRoot
13:47Chouserif it's bound but has no root, then it has only local binding.
13:47Chouseronly thread local
13:47Chouserif it's bound and also hasRoot, it may or may not have thread local binding.
13:49ChousergetThreadBinding 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:50cemerickwell, 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:51ChouserI guess my point is I'm not sure there's a single category that is descriptive for all IDeref's
13:51Chouseris a blocking promise the same kind of thing as an unforced delay?
13:53cemerickto a fn that doesn't want to wait for any computation behind an IDeref (regardless of its composition), yeah
13:54LauJensenGood 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:55Chouseralmost.
13:55drewrI agree, proonln is what it should have been called
13:55LauJensenIt was just an example
13:55drewr:-)
13:55Chouseryou can (ns mine (:refer-clojure :exclude [println]))
13:56Chouserthen (defmacro proonln [& args] `(clojure.core/println ~@args))
13:56ChouserI think that's as close as you can get
13:56Chouseroh, no...
13:56LauJensenChouser: But knowing that your first resolution is always a macro, are you sure this is nessarcary ? :)
13:57Chouser(def proonln clojure.core/println)
13:57Chousermaybe that
13:57LauJensenbingo
13:57LauJensenThanks
14:03LauJensenEnter Choujure :)
14:04stuartsierraAnd there was much rejoicing.
14:05LauJensenWohoo :)
14:06weissjcan someone give me a hint on how to get a macro to expand my "args" correctly: (defmacro define-task [name & args#]
14:06weissj `(defn ~name [& args#] (-> @testscript .getTasks ~(symbol (str "." name)) args#)))
14:07weissjthe problem is i want that last args# to not be a list, but rather the items in the list
14:07stuartsierrayou don't need the # on args.
14:07weissjstuartsierra: ok, but that doesn't solve the other problem right?
14:07stuartsierra`(defn ~name [~@args] ...)
14:08stuartsierrasplicing unquote
14:09weissjstuartsierra: yeah i saw that in the reader docs but it doesn't explain what it does
14:09weissjso i use the splicing unquote in both locations?
14:10stuartsierrayes
14:11weissjstuartsierra: 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:11stuartsierrawelcome
14:32hiredman~ping
14:32clojurebotPONG!
14:47cemerickhow 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:47stuartsierraI didn't know we were.
14:48cemerickhrm, then I'm really missing some context. What's the markdown references in this thread about "Contrib directory structure", then?
14:49cemerickoh, nevermind, my mail reader was hiding quoted material from me in a strange way
14:49bruceqIs there a minimal JVM that can run on iPhone?? I want to to use clojure for a new project.
14:49drewrI hate mail.app
14:50cemerickbruceq: Apple has banned any virtual machines, etc., on the iphone, so I wouldn't hold your breath
14:50stuartsierraI think Sean d. is suggesting markdown for library documentation, not docstrings.
14:50technomancybruceq: the JVM is not blessed enough to qualify for approval on that platform according to the high priests of Apple.
14:51cemerickdrewr: I'm open to suggestions. It's been my main reader for almost 10 years now (yikes!)
14:51bruceqI 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:51Chouserbruceq: give us another year or so and we may have a Clojure that compiles to Objective C
14:51cemerickbruceq: if you could statically link a native executable (maybe via gcj?), you might get it through
14:52bruceqChouser: Cool. what a bout the Married to JIT issues?
14:52drewrcemerick: I wish I had one to give you
14:52cemerickdrewr: the best of all the bad options, eh?
14:52weissjwhat is the compiler trying to tell me here: java.lang.Exception: Second argument to def must be a Symbol (console.clj:66)
14:52Chouserbruceq: not sure -- I guess I wouldn't assume the runtime performance would be stellar
14:53stuartsierraweissj: you wrote a (def ...) form the wrong way.
14:53weissjthe 2nd arg to def doesn't look like it should be a symbol to me
14:53weissjthe *first* arg is a symbol
14:53stuartsierramaybe the error message is wrong
14:53weissjstuartsierra: yeah, that's what i'm asking. i thought it looked wrong
14:54weissjand if it's wrong, what is it supposed to be telling me
14:54cemerickyeah, 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:54weissjso that i know what my error is
14:54stuartsierraweissj: can't tell you without looking at your code
14:54bruceqwhat about Clojure pumping to LLVM instead of Java JIT? Just a small matter of programming or theoretically a big problem?
14:55weissjstuartsierra: i'll assume it meant to say "first arg" and see if that helps me find anything, hang on
14:55stuartsierrabruceq: big problem; you'd need to reimplement Java.
14:55bruceqLLVM _is_ the future for all Apple infrastructure.
14:55dnolen_bruceq: I don't know enough about things to know which way to go, but supporting LLVM sounds like the most likely path.
14:56cemerickstuartsierra: 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:56stuartsierraYeah, but "just" includes threading, locks, atomic longs, GC, ...
14:56cemerickobviously couldn't use any java libs, but you could use js/obj c/chicken libs
14:57cemerickwell, targeting anything that doesn't already have GC is definitely a toughie. The rest of it is less onerous, it seems.
14:57lisppaste8weissj pasted "untitled" at http://paste.lisp.org/display/85542
14:57cemerick(given clojurescript as a baseline counter-example)
14:57weissjstuartsierra: ^
14:57stuartsierradefine-task is a macro, right?
14:58weissjstuartsierra: yeah
14:58bruceqwondering what rhickey thinks of the porting issues.
14:58stuartsierrayou can't apply a macro
14:58weissjstuartsierra: aw
14:58weissjcrap
14:58stuartsierraBut you can write another macro that expands into (do (define-task...) (define-task...) ...)
14:58cemerickbruceq: lots of the work he's been doing is specifically to enable targeting js, .NET, etc.
14:59cemerickhow far that is from LLVM or other lower-level targets is mostly above my pay grade
14:59weissjstuartsierra: ok
14:59cemerickalthough I have been turning the idea of a chicken scheme -> C backend over in my head for certain tasks
15:00technomancyoh wait, no threads--doh!
15:00weissjstuartsierra: that's the function i'm writing so what, i just loop thru my list and do define-task?
15:00cemericktechnomancy: well, js isn't multithreaded either (AFAIK) *shrug*
15:00stuartsierraweissj: Not exactly, you need to write a macro whose *expansion* contains (do (define-task...)...)
15:01cemerickthe 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:01weissjstuartsierra: sorry what i mean is i should turn this defn into a defmacro for starters
15:01stuartsierrayes
15:01weissjok
15:06Chousertechnomancy: right, what you want is an elisp frontend. :-)
15:15lisppaste8weissj pasted "untitled" at http://paste.lisp.org/display/85543
15:16weissjstuartsierra: i wrote this macro ^ but it doesn't expand into anything
15:16stuartsierrayou're still using defn, not defmacro
15:17weissjstuartsierra: haha DUH
15:18weissjstuartsierra: ok, now i get "java.lang.IllegalStateException: Var clojure.core/unquote is unbound. (NO_SOURCE_FILE:0)"
15:19stuartsierrayou've got an unquote on get-methods inside the unquote on the map
15:22weissjstuartsierra: great, all working now. thanks very much!
15:23stuartsierranp
15:28mebaran151is it possible to get the bytecode of a an anonymous fn?
15:28mebaran151or at least the string representation
15:28stuartsierrano
15:29mebaran151so nothing like the cool way smalltalk can serialize continuations
15:31stuartsierranot at present
15:31mebaran151nuts
15:34Chousukeyou could probably redef defn pretty easily to store the original form in the metadata of the var.
15:36stuartsierraThat's not going to give you continuations, though.
15:40LauJensenWhats the big deal with continuations anyway ?
15:40LauJensenI dont think Ive ever missed them in order to overcome any practical obstacle
15:40stuartsierrame neither
15:42mebaran151I just need the ability to adequately serialize a closure
15:42mebaran151continuations are actually kind of like macros
15:42dnolen_LauJensen: you can look at clj-cont mebaran, I wrote that a while ago to do just that.
15:42cemerickdelimited continuations cover at least 90% of the real use cases, and that's pretty straightforward
15:42dnolen_it's a port of cl-cont
15:43mebaran151you don't really know you can use them until you know you have them
15:43LauJensen~clj-cont
15:43clojurebotHuh?
15:43dnolen_http://github.com/swannodette/clj-cont/tree/master
15:43LauJensenswannodette?
15:43dnolen_yeah that's me.
15:43mebaran151continuations are very useful for doing backtracking searches
15:44LauJensenDepends on how you handle your backtracking
15:44mebaran151they're just a useful, succinct way of thinking about it
15:44mebaran151they come in handy for AI programming too
15:44LauJensenBut we could argue all night. The fact of the matter is, ClojureQl will meet all your needs
15:45mebaran151what do you mean?
15:45LauJensenNothing - Just doing a little advertising :)
15:45technomancyLauJensen: no way man, mire is the best.
15:45LauJensen~clojureql
15:45clojurebotclojureql is http://gitorious.org/clojureql
15:45mebaran151does clojure ql handle the serialization of arbitrarily nested clojure objects seemlessly?
15:45LauJensenI think that speaks for itself my friend :)
15:46LauJensenmebaran151: only in theory
15:46dnolen_mebaran151: also clojure.zip might be useful for what you are trying to do. that's in core.
15:47mebaran151I wrote a serializing backend on top of BerkeleyDB
15:47mebaran151it always seemed to me that for languages without explicit types, SQL was a really poor fit
15:49LauJensenClojureQl helps to close that gab a little bit
15:50cemerickmebaran151: BTW, I ended up going with jdbm instead of perst, and wrote a lucene Directory implementation on top of it.
15:50mebaran151why did you leave perst?
15:50mebaran151I checkedout JDBM: it looked it was suffering massive bitrot
15:51LauJensenSpeaking of bitrot, Chouser hows Clojurescript coming along ?
15:51cemerickmebaran151: 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:51ChouserLauJensen: dead pending c-in-c
15:51LauJensenSo sad :(
15:51mebaran151cemerick, I might have been misled
15:51LauJensenHows c-in-c coming along ?
15:52ChouserLauJensen: Chousuke's almost done with the reader. rhickey's almost done with newnew
15:52cemerickanyway, there's lots of chatter about how it's dead, but it definitely does the job pretty well so far.
15:53mebaran151looked like the last release was 3006
15:53mebaran151*2006
15:53ChousukeChouser: Almost done is an overstatement. It'll just be feature-complete soon. I'll still need to test and very likely optimise it.
15:53ChousukeChouser: and solve the problem it has currently that it might consume more of a stream that it needs to read a single object.
15:53cemerickI 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:54mebaran151sort of scared me off, so I had to go with the excessively over decorated bdb
15:54mebaran151yeah
15:54mebaran151annotations have ruined many good libraries....
15:54cemerickmebaran151: yeah, they're not exactly great with the releases
15:54ChousukeChouser: but those are problems that are easier to solve after I have something that reads strings and produces clojure code.
15:54cemericklast checkin was late last year *shrug*
15:54ChousukeI don't want to think about streams at this point ;(
15:55cemerickthe 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:55cemericknicely-extensible serialization interface, too
15:56cemerickOnce 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:56mebaran151I could use the lucene dir stuff
15:56mebaran151this the library that does arbitrary objects as well?
15:57mebaran151with or without serialization support?
15:57cemerickno, that's perst. And really, once I saw the impl of it, I was a little scared.
15:57cemerickSerious reflection voodoo.
15:58cemerickvery impressive, but I wouldn't count on deserializing such object graphs in a year or whatever.
15:58mebaran151yeah
15:58mebaran151reflection in Java is a dark art
15:59mebaran151did you ever check out tokyocabinet's word indexer
15:59mebaran151it's really excessively fast
15:59cemerickespecially when you see stuff like field.setAccessLevel(PUBLIC), or whatever.
15:59cemerickno. Its lack of windows support is a showstopper for this project.
15:59mebaran151oh yeah, I forgot
16:00mebaran151qdbm 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:00cemerickbut 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:01cemerickyeah. 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:07mebaran151jdbm is really that fast?
16:09mebaran151also did you check out the internal derby btree implementation
16:09mebaran151I bet it's no slouch
16:10stuartsierraI've heard Derby can''t compete with dedicated database servers.
16:11mebaran151for an embedded db though, paying IPC is pretty bad idea
16:12cemerickno, I've not looked at any derby internals
16:13cemerickbut I've certainly been impressed enough with jdbm's performance, at least for what I'm doing.
16:14cemerickI'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:14mebaran151I think most kv stores tend to be faster than you'd expect
16:14mebaran151there's just much less to do
16:15cemerickyeah, not having the sql around helps :-)
16:16LauJensencemerick: Did you know that ClojureQL now fully supports Derby, Mysql and psql, without you ever having to write a single sql statement? :)
16:16cemerickalthough 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:16cemerickLauJensen: I didn't, but then, I don't write any SQL now, either :-)
16:16LauJensen(k, just answer yes/no/wow plz)
16:18cemericksorry for ruining your plan ;-)
16:18stuartsierrawow
16:18stuartsierraBut I never liked query-generators ever since I found a bug in Rails' MySQL.
16:27wavisteri'm sure i'm not the first to bring this up, but does anyone else find this a little wrong?
16:27wavister,(keyword (str :map-key))
16:27clojurebot::map-key
16:28Chouser,(keyword (name :map-key))
16:28clojurebot:map-key
16:28wavisterglorious!
16:28wtetznerthat's because (str :map-key) returns ":map-key"
16:28wavisterwtetzner: i know...
16:28ChouserI don't think you'd want (str :foo) to return just "foo" most of the time
16:31stuartsierrafrequently, I do, but I agree it would be counter-intuitive
17:12weissjhow does one submit bugs against clojure? i found a minor one today (an exception message needs fixing to be accurate)
17:14hiredmanhttp://www.assembla.com/spaces/clojure/support/tickets
17:15LauJensenweissj: is it the infamous "NO MESSAGE" message? :)
17:15ChousukeHmm.
17:16ChousukeI wonder how I ever could edit lisp without paredit before. this is awesome.
17:16weissjLauJensen: 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:16LauJensenaha
17:16weissjwhoever wrote it was counting the symbol "def" as the first arg to def :)
17:17Chousuke,#(%20)
17:17clojurebot#<sandbox$eval__2029$fn__2031 sandbox$eval__2029$fn__2031@7673a2>
17:17Chousuke,#(%21)
17:17clojurebotjava.lang.Exception: Can't specify more than 20 params
17:20LauJensenChousuke: In Emacs you can have an interactive repl, so youre not dependant on Clojurebot, how does that sound? :)
17:23ChousukeLauJensen: sure. was too lazy to switch back to emacs window :P
17:28osaunders_~seen hiredman
17:28clojurebothiredman was last seen in #clojure, 14 minutes ago saying: http://www.assembla.com/spaces/clojure/support/tickets
17:34hiredmanI am sort of around
17:34osaunders_It's OK. I don't need you. :-)
17:34osaunders_I saw clojurebot was back so I wondered if you were too.
17:34osaunders_Oh and hi!
17:35drewrswitched from doseq to dorun/map and lo, no more heap blowage
17:35Chouseruh oh
17:36Chouserdrewr: you don't have to have a small self-contained example, do you?
17:36mebaran151isnt' doseq a simple macro around loop?
17:36mebaran151I would think map would be more likely to blow the heap
17:36Chouserdrewr: and/or try the new chunk-enabled doseq
17:37Chouserdrewr: http://www.assembla.com/spaces/clojure/documents/ayZsEAIHer3OuReJe5afGb
17:38hiredmandoesn't doseq also contain some for style stuff these days?
17:38drewrChouser: I've got chunks in this build, but it doesn't look like doseq is using them directly
17:38weissjhow do i get a symbol for the current namespace *ns* ?
17:38Chouserdrewr: no, the chunking doseq isn't checked in. I just finished it on Saturday
17:38weissji 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:39Chouser,(.name *ns*)
17:39clojurebotsandbox
17:39Chouserweissj: that's going to be hard since a bunch of what relies on the vvalue of *ns* happens at compile time
17:40hiredmanweissj: most ns functions will accept a namespace object or a symbol naming a namespace
17:41weissjChouser: yeah but i'm not evaluating ns at compile time
17:41weissj*ns* rather
17:41weissjor maybe i don't understand you
17:42Chouser,(read-string "`foo")
17:42clojurebot(quote sandbox/foo)
17:42Chouserweissj: I'm not sure what you're doing, just pointing out an area of complexity that may (or may not) cause you problems.
17:42weissjChouser: i think i see what you're saying, but i think it's still going to work for my purposes
17:42hiredmanweissj: def relies on the compile time value of *ns* for example
17:43weissjeven at compile time, i want a bunch of stuff def'd in *another* namespace
17:43weissjnot the current one
17:43drewrChouser: I've been trying various ways of isolating the problem with no luck
17:43hiredmanyou need to use intern
17:43weissjie, my code creates some functions in a separate ns
17:43hiredmanweissj: it won't
17:44weissjhiredman: oh yeah i recall seeing intern
17:44hiredmanthe code that creates functions is not run at compile time
17:44hiredmanit is just compiled
17:44hiredman(hence compile time)
17:44weissjhiredman: so what are you saying that it's compiled with some *ns* value hard-coded?
17:45hiredmanweissj: any def uses the compile time value of *ns*
17:45hiredmanso defn, etc
17:45hiredmanso you have to use intern
17:46weissjhiredman: 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:47hiredmanit will, just not for def
17:47hiredmanI think this is a with-ns in contrib
17:47hiredman,(doc with-ns)
17:47clojurebot"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:47osaunders_Does anybody know any good talks online about the multi-core CPU problem and why single cores aren't getting faster?
17:48hiredman~def with-ns
17:49hiredmanoh
17:49hiredmandisgusting
17:49hiredmana macro that emits calls to eval
17:52d2dchatBTW just release my codebase for my first ever clojure project
17:53d2dchathttp://github.com/lancecarlson/eugene/tree/master
17:53d2dchatfeedback appreciated :)
17:55tomojeugenics, huh?
17:55hiredman"Eugenics framework in clojure" sounds ominous
17:55clojurebot"[Clojure ...] feels like a general-purpose language beamed back from the near future."
17:57d2dchatEu = Good
17:57d2dchatGenics implies Genetics
17:57d2dchatI was a little bit worried about menacing connotations hehe
17:58d2dchatwas better than Genocide framework
17:59d2dchatthe problem with the word Eugenics is that it is too commonly associated with humans..
17:59d2dchatI think that that's false
17:59d2dchatit should be applied to all organisms.. as it has been practiced on others
17:59d2dchatit only happens to be morally repugnant when it's humans
18:00tomojhmm
18:01m3llingAnyone 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:01m3llingI copy the first few lines down to the dump-db
18:01m3lling(init-db)
18:01m3lling(dump-db cd)
18:01tomojgenetics is from genesis, but eugenics is from eugenes<-genos
18:01wavisteri 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:01m3llingthen error...
18:02d2dchattomoj: ah I just thought Eugene was a cute name that happened to look a lot like Eugenics lol
18:02tomojeugene is also from eugenes
18:03tomojthough eugenes could be applied to animals too, I thought it was always a person
18:04d2dchatI think Eugenics can be applied to anything that you can give "genetic code"
18:04d2dchatso programs too
18:04tomojperhaps it _should_ be that way
18:04tomojbut as it stands eugenics is specifically about humans :/
18:05d2dchatCan one challenge that notion?
18:05tomojsure but good luck being understood :)
18:05d2dchathehe
18:05tomojhuh, actually it appears eugenics can be any race/breed
18:05d2dchatPoint taken
18:05tomojbut most people just think of humans I guess
18:06d2dchatis this better? ominous
18:06d2dchatwhoops
18:06d2dchatEvolve your programs! Eugenics applied to software.
18:10wavistermaybe we'll finally have a race of futuristic supermen to design software for
18:10wavisterhttp://www.codinghorror.com/blog/archives/000821.html
18:10hiredmand2dchat: I think it is fine
18:17d2dchatwavister: That's my target audience :)
18:39weissjif 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:39weissji don't think i can use require, because i don't need to load anything
18:40Chousukedefine other namespaces? :/
18:40Chousukeyou can use create-ns
18:40hiredmanweissj: I would checkout the namespace section on the clojure website
18:42fsmHello 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:43fsmI could take out all that stuff if i knew expensive calculations would only be done if a name was referenced
18:43fsmat the moment, i do it by creating functions that return the values that i want, but a function call is also expensive.
18:44hiredmanthe only thing "lazy" in clojure are the lazy sequences
18:45fsmare there any standard idioms used to get around this clunky procedural stuff?
18:46hiredman-> and doto
18:47fsmbasically, 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:48fsmit would be very elegant just to declare all the names, and have the algorithm follow, like describing a math equation on paper
18:49hiredman,(doc promise)
18:49clojurebot"([]); 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:50weissji 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:50hiredmanso?
18:51weissjhiredman: so, i can't figure out how. refer doesn't appear to take an ":as"?
18:51hiredmanweissj: http://clojure.org/namespaces
18:51weissjhiredman: yeah i am looking at that
18:51hiredmanhttp://clojure.org/api#alias
18:52weissj"Add an alias in the current namespace to another namespace"
18:52hiredmanwell?
18:52weissjmaybe 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:53hiredman
18:53weissji want to define an alias in the current namespace, that points to another one
18:53hiredmanwhich is exactly what alias does
18:53weissjoh. then the doc did not make sense to me :)
18:53hiredmanit creates a namespace in the current namespace to another namespace
18:53hiredmaner
18:53hiredmanalias
18:54weissjit'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:55hiredman
18:55hiredmanit doesn't
18:55hiredman"in the current namespace"
18:56weissjadd what to what? Add "an alias in the current namespace" TO "another namespace". that's how i read it.
18:56weissjit's poorly worded, IMO :) or maybe i'm just dumb
18:56hiredmanAdd an alias, in the current namespace, to another namespace
18:57weissjit's ambiguous.
18:57weissjis it an alias TO something, or are you adding something TO something
18:57weissjit's not clear what the TO belongs to
18:57wavisterperhaps it should say "add to the current namespace an alias to another namespace"
18:58weissjwavister: yeah
18:58hiredmanit is not ambiguous
18:58bitbcktIt it awkward, but not ambiguous.
18:58bitbcktis*
18:59weissjit IS ambiguous. meaning 1: Add (an alias in the current namespace) to (another namespace)
18:59wavister"plain" english has problems
18:59weissjmeaning 2: Add (an alias) (to another namespace) (in the current namespace)
19:00bitbcktweissj: I would grant you (1), if the first clause read "an alias *to*..."
19:01weissjbitbckt: (1) is literally what it says.
19:01weissj(2) is the intended meaning
19:02weissj"to another namespace" either is a modifier for "alias in the currrent namespace" OR the the destination of the Add
19:02weissjanyway, i misread it, thanks for decoding it for me :)
19:03bitbcktClearly.
19:33lowlycoderanyone have identation not work in vimclojure? (it looks like garbage)
20:34m3llingI got this "CD db" example working http://blog.thinkrelevance.com/2008/9/16/pcl-clojure-chapter-3
20:34m3llingbut at the end I want to save-db and load-db
20:34m3llingthe save dumps the data in the proper format to a file called db.txt
20:35m3llingthen I try (load-db "db.txt" and I get an error.
20:35m3llingArrayIndexOut of bounds.
20:35m3lling(def xx (load-db "db.txt"))
20:44osaundersHow is everyone doing?
20:48m3llingno one is here.
22:14konrwhat book do you recommend me on distributed systems? Tannenbaum?