#clojure logs

2009-06-07

05:59MikeSethcan clojure run on non-Sun JVMs?
06:28kotarakMikeSeth: I would think so.
06:41asbjxrnOpenjdk is non-sun? I saw a thread in the clojure group just now where someone used it.
11:47dbudworthhi folks, anyone awake?
11:48durka42yes
11:49dbudworthI'm trying to create a printwriter / proxy output stream so I can re-define stdout. can't seem to get it to work. any chance someone can explain why this returns nil?
11:49dbudworth(.println (java.io.PrintWriter. (proxy [java.io.OutputStream] [] (write [& args] (println args)))) "foo")
11:50dbudworthnot why it returns nil, by why the println never gets called
11:52dbudworthbut, i get output if I remove the printwriter part from it and just call write on the outputstream
11:52dbudworth(.write (proxy [java.io.OutputStream] [] (write [& args] (println args))) (.getBytes "foo"))
11:52dbudworth(#<byte[] [B@fef72ea>)
11:52dbudworthnil
11:54dbudworthwow, ok. i'm dumb. just realized I was using PrintWriter, instead of PrintStream.
11:54dbudworthit worked after all, nevermind
13:15maacldbudworth: Did you get emacs/slime to work with the book code ?
13:17dbudworthyep, i dumped "emacs-starter-kit" and am just using elpa with my own swank-clojure-bin script that forces the classpath. easier for me to monkey with bash files than figure out the starter kit's init sequence
13:18dbudworthfinally up to lazy sequences in the prog clojure book. though, i had to figure out how to proxy the output stream on ant loggers so it showed up in the emacs repl
13:18dbudworth(since the emacs repl masks system.out)
13:19maacldbudworth: you are using clojure-mode right? look for swank-clojure-extra-classpaths - there you can add the path to the book source
13:19dbudworthmaacl: yep, that's what I was trying to do. starter-kit was overriding swank-clojure-extra-classpaths directly, so there was no work around I could find (other than edit the starter-kit)
13:20maacldbudworth: ah, ok
13:20dbudworthmaacl: plus the starter kit had all sorts on funkiness I wasn't used to (like ; adds a new line, doesn't comment an existing line)... easier to just use plain .emacs configs
13:21maacldbudworth: yeah, that's i what I ended up doing too
15:08duck1123If I wanted the results of a sql query in a vec of my own structs, would it be better to map over the seq and return new structs, or create something new that didn't use resultset-seq
15:10duck1123I wish that resultset-seq could accept an optional param for the struct that you wanted the results returned as. (as opposed to row-struct)
16:18hiredman,(+ 18 15)
16:18clojurebot33
16:21technomancywhew; math still works
16:27technomancyheh: "You can now write LISP and compile it to target the JVM. all arguments should now immediately end." (http://twitter.com/bengl3rt/statuses/2067336126)
19:18dbudworthanyone familiar with swank-clojure? this works from shell repl but not *slime-repl clojure* (def foo 10) (defn printfoo [] (println foo)) (printfoo) (binding [foo "bound foo"] (printfoo))
19:38drewrdbudworth: What error do you get?
19:38dbudworthdon't get any error, just the binding doesn't apply (it prints 10 both times)
19:39dbudworthcopy/paste to a terminal running the cmd line repl, prints "10" followed by "bound foo"
19:39Chousukehm
19:39dbudworthspecific to slime-clojure it seems. maybe due to stealing the outputstreams, not sure if the print becomes lazy there (wouldn't think so)
19:40Chousukemight be that slime runs it in a different thread and it confuses the binding
19:40drewrI get the correct output, so it must be a recent slime issue.
19:40Chousukesince bindings are thread-local
19:40drewrI haven't updated in a while.
19:40dbudworththat's what I was thinking. it was an example from programming clojure. oddly enough, the very next example that uses binding is correct
19:41dbudworthbut it's not actually printing anything
19:41dbudworthso i thought it had something to do with *out* being re-defined by swank, somehow making the output async or something
19:41dbudworth(obviously, i'm still learning this stuff, otherwise I'd know)
19:44duck1123_interestingly, when I eval that last line, I ger "bound foo" twice
19:44dbudworththere's a few incompatibilities with slime / prog clojure examples. ie: the ant tasks print to the wrong buffer. *out* is redefined, but System.out isn't
19:44duck1123_other than that, it works for me with 1.0
19:45dbudworthended up writing my own printstream / outputstream proxy (which was a fun experiment as the book gives no clue there)
19:45duck1123_of course, I'm connecting to an already runnung clojure instance
19:46dbudworthahh! the programming-clojure example ships with Clojure 1.1.0-alpha-SNAPSHOT
19:46dbudworththat repl doesn't work either
19:46dbudworthbut does with 1.0
19:46dbudworthand that's what I'm running with slime, the 1.1 snapshot
19:47duck1123_I gave up on post 1.0 clojure when I started getting weird errors, and haven't needed any post-1.0 stuff
19:48dbudworthyep, really no reason to use it for the book as it's based on 1.0 it's just the git repo (as of 2 days ago) has 1.1 alpha. i'll switch it
19:48duck1123_is that chunked seq stuff ready to go yet? It looked interesting, but haven't played with it.
22:14Tulsihi