2009-08-17
| 00:00 | JAS415 | god |
| 00:00 | JAS415 | i hate java |
| 00:01 | JAS415 | there really has to be 10 types of image? |
| 00:01 | JAS415 | all which are incompatible and have to be transformed in some sort of abstract voodoo? |
| 00:01 | JAS415 | and once you transform them they don't even work but come up as blank images |
| 00:02 | JAS415 | i've fought with this all day and it doesn't even display properly! |
| 00:02 | JAS415 | wtf. |
| 00:02 | JAS415 | i could have implemented my own image library in this time or something |
| 00: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. |
| 00:42 | JAS415 | JAI? |
| 00:43 | JAS415 | i'm trying to use the builtins and i just can't make it work |
| 00:43 | cemerick | java advanced imaging |
| 00: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 |
| 00:44 | JAS415 | it seems like simple stuff, but i'm just too incompetent i guess |
| 00:45 | JAS415 | so either |
| 00:45 | JAS415 | i end up throwing an exception that is basically meaningless |
| 00:45 | JAS415 | 'invalid argument to native writeImage' |
| 00:45 | JAS415 | or 1/2 of the images come up empty |
| 00:46 | JAS415 | honestly is driving me nuts |
| 00: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) |
| 00:46 | cemerick | You need a buffered image, but that's pretty straightforward (and chances are, the image you have is already a bufferedimage) |
| 00:47 | JAS415 | yeah i have one |
| 00:47 | JAS415 | in fact i'm using that |
| 00:47 | JAS415 | i'm using exactly that |
| 00:47 | JAS415 | i've had it writing to file |
| 00:47 | JAS415 | its just that like |
| 00:48 | JAS415 | sometimes it works sometimes it doesn't |
| 00:48 | JAS415 | its completely hit or miss |
| 00:48 | cemerick | well, then you've got some images with oddball ColorModels and such |
| 00:48 | cemerick | we did some testing of the .NET libs, and they have much weaker support for such ColorModels than java's image libraries, FWIW |
| 00:49 | cemerick | 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. |
| 00:50 | JAS415 | i don't even know about color models |
| 00:50 | JAS415 | all i'm doing is getting images from a url |
| 00:51 | JAS415 | converting them to buffered |
| 00:51 | JAS415 | and writing to file |
| 00:51 | JAS415 | i'm just freaking exhausted at this point |
| 00:51 | cemerick | how are you converting them to BufferedImages? |
| 00:51 | JAS415 | (defn to-buffered-image [image] |
| 00:51 | JAS415 | (let [b (new BufferedImage (.getWidth image) (.getHeight image) BufferedImage/TYPE_INT_ARGB) |
| 00:51 | JAS415 | g (.createGraphics b)] |
| 00:51 | JAS415 | (.drawImage g image (new java.awt.geom.AffineTransform) nil) |
| 00:51 | JAS415 | b)) |
| 00:52 | JAS415 | that didn't work well |
| 00:52 | cemerick | right. If the image doesn't have a color model compatible with ARGB, then you won't be happy |
| 00:53 | cemerick | is the raw Image you get from the URL load not a BufferedImage already? |
| 00:53 | JAS415 | hold on i'll put it on lisppaste |
| 00:54 | lisppaste8 | Jon pasted "I can't get this to work.." at http://paste.lisp.org/display/85501 |
| 00:54 | JAS415 | granted I had it moderately working before |
| 00:54 | JAS415 | and now it is just not working at all |
| 00:55 | cemerick | and your overall objective is? |
| 00:55 | JAS415 | ok |
| 00:56 | JAS415 | access image, convert to buffered image, cache on disk, display as imageicon |
| 00:56 | JAS415 | later, retrieve from disk instead of going out to the web |
| 00:56 | cemerick | why convert it to a buffered image? Is it not already one when you get it back from the toolkit? |
| 00:57 | JAS415 | it is a ToolkitImage |
| 00:57 | JAS415 | which is not a buffered Image |
| 00:58 | JAS415 | so |
| 00:58 | JAS415 | you can't save a toolkit image to disk |
| 00:58 | JAS415 | but you can save a bufferedimage to disk |
| 00:58 | JAS415 | i think |
| 00:59 | cemerick | I'd use ImageIO.read to get the URL's image data (once you have an inputstream to it), rather than toolkit |
| 00:59 | JAS415 | hmm |
| 00:59 | cemerick | then you're always working with buffered images |
| 00:59 | JAS415 | good point |
| 00:59 | JAS415 | I will do try to do that |
| 01: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. |
| 01:00 | cemerick | good luck :-) |
| 01:00 | JAS415 | thanks :-) |
| 01:06 | Knekk | is there a way I can override the symbol's print representation? i.e. (println `+) => + and not clojure.core/+ ? |
| 01:21 | arbscht | Knekk: syntax-quote will resolve the symbol. (println '+) might achieve what you want; or generally (name '+) |
| 02:42 | lowlycoder | hey, |
| 02:42 | lowlycoder | sorry for wasting a line |
| 02:42 | lowlycoder | how do i get clojure to print out the clss path for me? |
| 02:42 | lowlycoder | (.System (.Property)) is printing out too much shit |
| 02:42 | lowlycoder | err, sorry for language |
| 02:45 | tomoj | (System/getProperty "java.class.path") ? |
| 02:46 | lowlycoder | cool; thanks |
| 02:46 | lowlycoder | 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 |
| 02:46 | tomoj | what's (.System (.Property))? |
| 02:46 | tomoj | that doesn't make sense to me |
| 02: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: |
| 02:47 | lowlycoder | #<CompilerException java.lang.NoClassDefFoundError: Could not initialize class com.sun.opengl.impl.x11.X11GLDrawableFactory (opengl-gears.clj:0)> |
| 02:47 | lowlycoder | the above is me being stupid since im learning clojure |
| 02:50 | arbscht | what's in opengl-gears.clj? |
| 03: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" |
| 03:01 | lowlycoder | /usr/share/java/jogl.jar contains: com/sun/opengl/impl/x11/X11GLDrawableFactory.class |
| 03:01 | lowlycoder | yet when I try to do: (import '(com.sun.opengl.impl.x11 X11GLDrawableFactory)) |
| 03:01 | lowlycoder | i get an error of: #<CompilerException java.lang.NoClassDefFoundError: Could not initialize class com.sun.opengl.impl.x11.X11GLDrawableFactory (test.clj:0)> |
| 03:01 | lowlycoder | what's going on? |
| 03:06 | hiredman | clojurebot: how many things do you know? |
| 03:06 | clojurebot | I don't understand. |
| 03:06 | hiredman | clojurebot: how much do you know? |
| 03:06 | clojurebot | I know 337 things |
| 03:07 | hiredman | crap |
| 03:07 | hiredman | sorry |
| 03:30 | lowlycoder | what's the equiv of: "import java.awt.*" ? |
| 03:31 | Fossi | lowlycoder: there's none |
| 03:32 | tomoj | yay clojurebot is back |
| 03:32 | Fossi | afaik at least |
| 03:32 | lowlycoder | so i have to load them one by one? |
| 03:40 | tomoj | you have to import whichever classes you want to refer to by a short name |
| 04:10 | lowlycoder | how do I connect to a cojure server, see what all the active threads are |
| 04:10 | lowlycoder | and then selectively kill them? |
| 04:11 | lowlycoder | err sorry, let me rephrase that |
| 04:11 | lowlycoder | i'm at a clojure repl |
| 04:11 | lowlycoder | how do I get a list of all active java threads |
| 04:11 | lowlycoder | and then kill them |
| 04:19 | arbscht | wahey, clojurebot :) |
| 04:32 | arbscht | lowlycoder: something like this can get you a seq of threads http://gist.github.com/168997 |
| 04:33 | lowlycoder | whoa, did you write that just for me? |
| 04:33 | MidKnight | testing... |
| 04:33 | arbscht | sure, just a quick proof of concept |
| 04: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(/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:34 | MidKnight | Hey everyone, I am brand new to Clojure |
| 04:34 | lowlycoder | err, sorry |
| 04:34 | lowlycoder | please don't kick ban |
| 04:34 | lowlycoder | did not mean to paste that much |
| 04:35 | arbscht | the point is clojure threads are just java threads; you can play with them via the java api |
| 04:35 | lowlycoder | http://paste.lisp.org/display/85505 |
| 04:35 | lowlycoder | sorry for dumb question |
| 04:35 | lowlycoder | how do I ask it to kill all the ones named de.kotka.vimclojure.nails.* ? |
| 04:36 | lowlycoder | wait, that's actually not all that I want to kill |
| 04:36 | lowlycoder | hmm |
| 04:36 | Fossi | hi MidKnight |
| 04:36 | arbscht | ideally, you wouldn't... Thread/stop is deprecated |
| 04:37 | lowlycoder | so what should I be doing isntead? |
| 04:38 | MidKnight | Hi fossi |
| 04:39 | arbscht | spawn threads which check for a signal to live or die, for example. the java docs describe this in detail |
| 04:39 | arbscht | http://java.sun.com/javase/6/docs/technotes/guides/concurrency/threadPrimitiveDeprecation.html |
| 04:39 | lowlycoder | arbscht: which java docs? (sorry, i'm new to java) |
| 04:39 | lowlycoder | nice; thanks |
| 04:41 | lowlycoder | private volatile Thread blinker; |
| 04:41 | lowlycoder | public void stop() { |
| 04:41 | lowlycoder | blinker = null; |
| 04:41 | lowlycoder | } |
| 04:41 | lowlycoder | wtf? have it garbage collected? |
| 04:41 | lowlycoder | is that the idea? |
| 04:42 | lowlycoder | no wait; that's not how it works |
| 04:42 | lowlycoder | why does blinker have to be volatile? |
| 04:42 | lowlycoder | because it can change between threads? |
| 04: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 |
| 04:46 | lowlycoder | is Thread/stop is deprecated; and I write a runaway thread; how do I kill it? |
| 04:47 | AWizzArd | Sun suggests that the thread itself should check for the state of some var as a signal to just stop. |
| 04:47 | lowlycoder | right; but if I screw up on that; there's no way to fix it? |
| 04:47 | lowlycoder | suppose i'm running this mission criticial jvm that can't be taken down |
| 04: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 :) |
| 04:48 | lowlycoder | and some newb intern throws on their a thread that just while(1) { allocate lots of crap} |
| 04:48 | lowlycoder | it just eats up the jvm ram? |
| 04: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 |
| 04: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 |
| 04:52 | lowlycoder | okay, so i'm using vimclojure |
| 04:53 | lowlycoder | what's the easiest way to leat each "reloadfile" kill the previous one |
| 04:53 | lowlycoder | hmm, this question is poorly asked |
| 05:21 | ole3 | hello i like to split my project into different files, where do i put the package description (e.g. ns) ? |
| 05:25 | Chousuke | ole3: the ns declaration should be in the file that corresponds to the namespace. |
| 05:26 | Chousuke | ole3: to split your project, you can either have multiple namespaces, or use load-file |
| 05:32 | ole3 | Chousuke: like: project.clj: (ns project (:import (java.io File FileInputStream))) (load-file "file1.clj") (load-file "file2.clj") |
| 05:33 | Chousuke | yeah. though usually your ns declaration should have at least two parts. |
| 05:36 | ole3 | Chousuke: What parts? |
| 05:36 | Chousuke | as in. ole3.project |
| 05:36 | Chousuke | and then put the code in ole3/project.clj |
| 05:36 | ole3 | ah, ok thank you |
| 05:37 | Chousuke | and add the directory where ole3/ is to classpath |
| 05:38 | ole3 | ok |
| 05:40 | ole3 | Is it ok to mix java and clj in a directory tree, or should they keep in seperate trees? |
| 05:46 | Fossi | i guess it would be okay, but uncommon |
| 05:47 | Fossi | to me it would signal a pretty strong dependency |
| 06:05 | rottcodd | how can I check if an object is a java array? |
| 06:20 | y-combinator | Hello, im running Clojure on Mac with Java version "$ java -version |
| 06:20 | y-combinator | java version "1.6.0_13" |
| 06:20 | y-combinator | Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211) |
| 06:20 | y-combinator | 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? |
| 06:21 | rsynnott | what sort of errors are you getting? |
| 06:21 | rsynnott | was the colleague using Java1.5 or 1.6? |
| 06:22 | y-combinator | some random problems with classpath |
| 06:22 | y-combinator | he is used latest version of java 1.6 from Sun |
| 06:22 | y-combinator | $ ant |
| 06:22 | y-combinator | Buildfile: build.xml |
| 06:22 | y-combinator | def-tasks: |
| 06:22 | y-combinator | BUILD FAILED |
| 06:22 | y-combinator | java.lang.ExceptionInInitializerError |
| 06:22 | y-combinator | at java.lang.Class.forName0(Native Method) |
| 06:22 | y-combinator | at java.lang.Class.forName(Class.java:242) |
| 06:22 | y-combinator | at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:583) |
| 06:22 | y-combinator | at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:228) |
| 06:22 | y-combinator | at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) |
| 06:30 | y-combinator | ok, solved by running ant with "-noclasspath" |
| 08:13 | cemerick | holy crap, git-bisect is wonderful |
| 08:14 | Chouser | when you need it, it's exactly what you need. |
| 08:14 | Chousuke | heh. |
| 08:15 | Chousuke | it does require some discipline in your commits to have git-bisect work well, though. |
| 08:15 | cemerick | Chousuke: how so? |
| 08:15 | Chousuke | if some commit breaks your build. it'll make git bisect less useful. |
| 08:16 | arbscht | Chouser: as bad as ,expr failing? the channel felt empty without clojurebot |
| 08:16 | cemerick | ah, right |
| 08:16 | Chousuke | you'll skip the broken commit of course, but then you might end up with the wrong commit being blamed for breakage :/ |
| 08:16 | Fossi | well, at least you can have local commits in git that don't show up in the blessed repo |
| 08:16 | Fossi | unlike hg |
| 08:16 | cemerick | seems like that makes rebase even more important, so that interim commits don't ever make it into an authoritative repo |
| 08:17 | Chousuke | yeah, squashing "oops" commits is a nice way to keep development history clean |
| 08:18 | cemerick | stuff like this keeps reminding me that I made the right decision on git vs. hg :-P |
| 08: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. |
| 08:22 | cemerick | well, there's no rebase in hg. That was my biggest issue with it. |
| 08:54 | ole3 | hi, now my little project is working, but how do i create an executable? |
| 08:55 | Chousuke | you usually don't. but you can make it a jar. |
| 08:55 | ole3 | why not? |
| 08:56 | Chousuke | well, java projects are usually distributed as jars |
| 08:56 | cark | hum i usually do =) |
| 08:56 | cark | ahyes an executable jar yes |
| 08:56 | Chousuke | but I have to say I have no idea how to make jars myself :P |
| 08:56 | ole3 | executable jar? a script? |
| 08:57 | cark | you know, a jar that can be started easily like this : java -jar myjar.jar |
| 08: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? |
| 08:58 | ole3 | ok, so i need to generate class files somehow |
| 08:58 | cark | ole3 : you could do without it, but yes you can do class file generation, AOT compilation |
| 08:58 | Chousuke | http://asymmetrical-view.com/2009/06/22/executable-clojure-jars.html |
| 08:58 | cemerick | ole3: not necessarily |
| 08:58 | cemerick | or, http://www.google.com/search?q=executable+jars </snarky> |
| 08:59 | Chousuke | some of the google hits are obsolete information though. |
| 08:59 | Chousuke | having references to gen-and-save-class :| |
| 09:00 | cark | ole3 : it takes a bit of research to have a good build process ... |
| 09:00 | cark | hamza : declare your ref from a file that will be imported from both files |
| 09:01 | Chousuke | ole3: the clojure unit of compilation is a namespace. |
| 09:01 | cark | from/if |
| 09:01 | cark | of =/ |
| 09:01 | cark | damn i need coffee =) |
| 09:01 | Chousuke | ole3: so if you have a namespace in your classpath, (compile 'your.namespace) will compile it |
| 09:01 | ole3 | ok, but a source file needs the jna library so compile failed |
| 09:02 | ole3 | but jna.jar is in the classpath |
| 09:02 | Chousuke | hmm |
| 09: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 |
| 09:04 | Chousuke | yeah. it'll probably be easier to just put your .clj files in there |
| 09: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. |
| 09:04 | Chouser | hm. I guess I usually genclass a main menthod. :-/ |
| 09:04 | ole3 | ok, i will try that, thanks |
| 09: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. |
| 09:05 | cark | someone should do a nice writeup on how to do the full build process |
| 09:05 | cark | too bad i don't have a blog |
| 09:07 | ole3 | clojure application delivery is like common lisp application deliver :) |
| 09:07 | Chouser | oh, really? CL want's you to write ant scripts in XML too? |
| 09:07 | Chouser | :-) :-) |
| 09:07 | cark | i do it more like c ... using ant as make |
| 09:08 | Chousuke | dealing with jars and clojure is a bit painful still I guess. |
| 09:08 | cark | the pain comes from ant |
| 09:08 | cark | i really can't stand xml |
| 09:08 | Chousuke | but I suppose that'll get better as Clojure matures. |
| 09:09 | Chousuke | XML itself is not horrible, but the way ant uses it is :( |
| 09:09 | cark | well as soon as the xml file is more than a page long, it becomes unreadable |
| 09:09 | cemerick | neither ant nor jars are particularly difficult.... |
| 09:10 | cark | cemerick : difficult to read |
| 09:10 | cark | that's write only stuff |
| 09:10 | cemerick | the clojure buildfile itself produces an executable jar in about 12 lines *shrug* |
| 09:11 | cark | right, but you might want to have libs automatically added for instance |
| 09:11 | cark | then make nice zip |
| 09:11 | cemerick | from contrib, you mean? |
| 09:11 | cark | all the libs for your application |
| 09:11 | cemerick | lisppaste8: url? |
| 09:11 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 09:13 | lisppaste8 | cemerick pasted "seriously, producing jars containing your clojure code and others' libs isn't hard..." at http://paste.lisp.org/display/85515 |
| 09:13 | cark | that's part of it |
| 09:13 | cemerick | besides that, there's nothing stopping anyone from using make, rake, etc etc |
| 09:13 | lisppaste8 | cark pasted "there is more to it" at http://paste.lisp.org/display/85516 |
| 09:14 | Neronus | or custom binary executables |
| 09:14 | cark | it takes a while to have someting that works ...anyways i'm past that so i don't care =D |
| 09:14 | cemerick | cark: I think you just described *all* build processes/tools ;-) |
| 09:15 | cark | hehe you might be right indeed |
| 09:15 | cark | i just which we would have some neat stuff in clojure |
| 09:15 | cark | with all the capabilities of ant |
| 09:15 | cemerick | yeah, I was just about to say that |
| 09:16 | cark | my understanding was that lancet was a wrapper around ant ? |
| 09:16 | Chouser | a wrapper that avoids the xml I believe |
| 09:17 | cemerick | I don't know if avoiding XML is the biggest issue with build processes. |
| 09:17 | cemerick | 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 | ole3 | In lib is clojure.jar and jna.jar |
| 10:06 | ole3 | in src is com/etc/projects/.... |
| 10:07 | ole3 | and i have a shell script starting the clojure repl and loading the project. |
| 10:07 | ole3 | 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 | Chouser | (defn build-string:String [& args] ...) ? |
| 11:44 | Chousuke | Chouser: hmm. |
| 11:45 | Chouser | Chousuke: exactly. |
| 11:45 | Chouser | 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 | cemerick | I thought you were trying to use the defh or something. |
| 11:47 | Chousuke | then I could possibly allow nested #()s |
| 11:47 | Chousuke | hmm.) |
| 11:48 | Chouser | Chousuke: #() were originally allowed. |
| 11:48 | Chouser | 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 | Chouser | I'm worried foo:Type reverses that. |
| 11:50 | Chouser | foo:{:other :meta-data} ?? |
| 11:51 | Chousuke | I already have strings, numbers, basic symbol parsing, regex patterns, lists, maps sets and vectors |
| 11:51 | Chousuke | 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 | cemerick | Maybe that means it's useful binding forms, but not at call-sites. |
| 11:52 | cemerick | (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 | Neronus | 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 | Chousuke | 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 | Neronus | 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 | Chousuke | 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 | drewr | although I'm only using response-body-str atm |
| 12:19 | drewr | 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 | stuartsierra | Next step is a higher level interface with functions like get/post/put. |
| 12:21 | stuartsierra | But that will be a separate lib. |
| 12:22 | drewr | I can envision some multimethods for different content-types |
| 12:23 | drewr | 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 | stuartsierra | 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 | drewr | 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 | stuartsierra | Should the response body methods block until the response is completed? |
| 13:04 | stuartsierra | (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 | stuartsierra | 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 | Chousuke | 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 | stuartsierra | 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 | Chouser | (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 | stuartsierra | 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 | cemerick | 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:35 | Chouser | ok, maybe a bit. |
| 13:35 | Chouser | well, not vars -- that's definitely come up. |
| 13:35 | drewr | do you guys know if jdbc connections have issues getting GCed? |
| 13:36 | drewr | (after they're close()ed, of course) |
| 13:42 | cemerick | Chouser: oh, right. That'd be .hasRoot, then? |
| 13:43 | cemerick | drewr: not usually, unless there's a native lib in the background (I think those are called Type II drivers?) |
| 13:43 | cemerick | I remember having GC issues with oracle's type 2 driver...gawd...in 2002? :-| |
| 13:44 | drewr | it's a long shot... |
| 13:44 | drewr | 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 | drewr | feels that way at least |
| 13:46 | Chouser | if a var exists it can have any combination of .isBound and .hasRoot |
| 13:47 | Chouser | if it's bound but has no root, then it has only local binding. |
| 13:47 | Chouser | only thread local |
| 13:47 | Chouser | if it's bound and also hasRoot, it may or may not have thread local binding. |
| 13:49 | Chouser | 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 | Chouser | 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 | Chouser | then (defmacro proonln [& args] `(clojure.core/println ~@args)) |
| 13:56 | Chouser | I think that's as close as you can get |
| 13:56 | Chouser | 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 | Chouser | maybe that |
| 13:57 | LauJensen | bingo |
| 13:57 | LauJensen | Thanks |
| 14:03 | LauJensen | Enter Choujure :) |
| 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 | weissj | `(defn ~name [& args#] (-> @testscript .getTasks ~(symbol (str "." name)) args#))) |
| 14:07 | weissj | 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 | 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 | weissj | so i use the splicing unquote in both locations? |
| 14:10 | stuartsierra | yes |
| 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:49 | cemerick | oh, nevermind, my mail reader was hiding quoted material from me in a strange way |
| 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 | weissj | 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 | weissj | 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 | cemerick | 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 | weissj | 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 | cemerick | 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 | 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 | weissj | 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 | mebaran151 | 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 | LauJensen | 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 | mebaran151 | 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 | mebaran151 | 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 | LauJensen | 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 | mebaran151 | 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 | mebaran151 | 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 | mebaran151 | *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 | Chousuke | 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 | mebaran151 | yeah |
| 15:54 | mebaran151 | 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 | cemerick | nicely-extensible serialization interface, too |
| 15:56 | cemerick | 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 | mebaran151 | this the library that does arbitrary objects as well? |
| 15:57 | mebaran151 | 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 | cemerick | Serious reflection voodoo. |
| 15:58 | cemerick | very impressive, but I wouldn't count on deserializing such object graphs in a year or whatever. |
| 15:58 | mebaran151 | yeah |
| 15:58 | mebaran151 | reflection in Java is a dark art |
| 15:59 | mebaran151 | did you ever check out tokyocabinet's word indexer |
| 15:59 | mebaran151 | it's really excessively fast |
| 15:59 | cemerick | especially when you see stuff like field.setAccessLevel(PUBLIC), or whatever. |
| 15:59 | cemerick | no. Its lack of windows support is a showstopper for this project. |
| 15:59 | mebaran151 | oh yeah, I forgot |
| 16:00 | mebaran151 | 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 | cemerick | 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 | mebaran151 | also did you check out the internal derby btree implementation |
| 16:09 | mebaran151 | 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 | cemerick | but I've certainly been impressed enough with jdbm's performance, at least for what I'm doing. |
| 16:14 | cemerick | 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 | mebaran151 | 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 | cemerick | 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 | stuartsierra | 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 | wavister | ,(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 | Chousuke | 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 | osaunders_ | I saw clojurebot was back so I wondered if you were too. |
| 17:34 | osaunders_ | 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 | Chouser | 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 | mebaran151 | 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 | Chouser | 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 | weissj | *ns* rather |
| 17:41 | weissj | 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 | weissj | 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 | hiredman | it is just compiled |
| 17:44 | hiredman | (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 | hiredman | so defn, etc |
| 17:45 | hiredman | 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 | hiredman | I think this is a with-ns in contrib |
| 17:47 | hiredman | ,(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 | hiredman | oh |
| 17:49 | hiredman | disgusting |
| 17:49 | hiredman | a macro that emits calls to eval |
| 17:52 | d2dchat | BTW just release my codebase for my first ever clojure project |
| 17:53 | d2dchat | http://github.com/lancecarlson/eugene/tree/master |
| 17:53 | d2dchat | 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 | d2dchat | Genics implies Genetics |
| 17:57 | d2dchat | I was a little bit worried about menacing connotations hehe |
| 17:58 | d2dchat | was better than Genocide framework |
| 17:59 | d2dchat | the problem with the word Eugenics is that it is too commonly associated with humans.. |
| 17:59 | d2dchat | I think that that's false |
| 17:59 | d2dchat | it should be applied to all organisms.. as it has been practiced on others |
| 17:59 | d2dchat | 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 | m3lling | I copy the first few lines down to the dump-db |
| 18:01 | m3lling | (init-db) |
| 18:01 | m3lling | (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 | tomoj | 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 | d2dchat | so programs too |
| 18:04 | tomoj | perhaps it _should_ be that way |
| 18:04 | tomoj | 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 | d2dchat | whoops |
| 18:06 | d2dchat | 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 | wavister | 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 | weissj | i don't think i can use require, because i don't need to load anything |
| 18:40 | Chousuke | define other namespaces? :/ |
| 18:40 | Chousuke | 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 | fsm | I could take out all that stuff if i knew expensive calculations would only be done if a name was referenced |
| 18:43 | fsm | 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 | fsm | 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 | hiredman | er |
| 18:53 | hiredman | 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 | hiredman | it doesn't |
| 18:55 | hiredman | "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 | weissj | 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 | weissj | is it an alias TO something, or are you adding something TO something |
| 18:57 | weissj | 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 | bitbckt | 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 | weissj | (2) is the intended meaning |
| 19:02 | weissj | "to another namespace" either is a modifier for "alias in the currrent namespace" OR the the destination of the Add |
| 19:02 | weissj | 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 | m3lling | but at the end I want to save-db and load-db |
| 20:34 | m3lling | the save dumps the data in the proper format to a file called db.txt |
| 20:35 | m3lling | then I try (load-db "db.txt" and I get an error. |
| 20:35 | m3lling | ArrayIndexOut of bounds. |
| 20:35 | m3lling | (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? |