2009-06-07
| 05:59 | MikeSeth | can clojure run on non-Sun JVMs? |
| 06:28 | kotarak | MikeSeth: I would think so. |
| 06:41 | asbjxrn | Openjdk is non-sun? I saw a thread in the clojure group just now where someone used it. |
| 11:47 | dbudworth | hi folks, anyone awake? |
| 11:48 | durka42 | yes |
| 11:49 | dbudworth | I'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:49 | dbudworth | (.println (java.io.PrintWriter. (proxy [java.io.OutputStream] [] (write [& args] (println args)))) "foo") |
| 11:50 | dbudworth | not why it returns nil, by why the println never gets called |
| 11:52 | dbudworth | but, i get output if I remove the printwriter part from it and just call write on the outputstream |
| 11:52 | dbudworth | (.write (proxy [java.io.OutputStream] [] (write [& args] (println args))) (.getBytes "foo")) |
| 11:52 | dbudworth | (#<byte[] [B@fef72ea>) |
| 11:52 | dbudworth | nil |
| 11:54 | dbudworth | wow, ok. i'm dumb. just realized I was using PrintWriter, instead of PrintStream. |
| 11:54 | dbudworth | it worked after all, nevermind |
| 13:15 | maacl | dbudworth: Did you get emacs/slime to work with the book code ? |
| 13:17 | dbudworth | yep, 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:18 | dbudworth | finally 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:18 | dbudworth | (since the emacs repl masks system.out) |
| 13:19 | maacl | dbudworth: you are using clojure-mode right? look for swank-clojure-extra-classpaths - there you can add the path to the book source |
| 13:19 | dbudworth | maacl: 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:20 | maacl | dbudworth: ah, ok |
| 13:20 | dbudworth | maacl: 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:21 | maacl | dbudworth: yeah, that's i what I ended up doing too |
| 15:08 | duck1123 | If 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:10 | duck1123 | I 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:18 | hiredman | ,(+ 18 15) |
| 16:18 | clojurebot | 33 |
| 16:21 | technomancy | whew; math still works |
| 16:27 | technomancy | heh: "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:18 | dbudworth | anyone 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:38 | drewr | dbudworth: What error do you get? |
| 19:38 | dbudworth | don't get any error, just the binding doesn't apply (it prints 10 both times) |
| 19:39 | dbudworth | copy/paste to a terminal running the cmd line repl, prints "10" followed by "bound foo" |
| 19:39 | Chousuke | hm |
| 19:39 | dbudworth | specific to slime-clojure it seems. maybe due to stealing the outputstreams, not sure if the print becomes lazy there (wouldn't think so) |
| 19:40 | Chousuke | might be that slime runs it in a different thread and it confuses the binding |
| 19:40 | drewr | I get the correct output, so it must be a recent slime issue. |
| 19:40 | Chousuke | since bindings are thread-local |
| 19:40 | drewr | I haven't updated in a while. |
| 19:40 | dbudworth | that's what I was thinking. it was an example from programming clojure. oddly enough, the very next example that uses binding is correct |
| 19:41 | dbudworth | but it's not actually printing anything |
| 19:41 | dbudworth | so i thought it had something to do with *out* being re-defined by swank, somehow making the output async or something |
| 19:41 | dbudworth | (obviously, i'm still learning this stuff, otherwise I'd know) |
| 19:44 | duck1123_ | interestingly, when I eval that last line, I ger "bound foo" twice |
| 19:44 | dbudworth | there'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:44 | duck1123_ | other than that, it works for me with 1.0 |
| 19:45 | dbudworth | ended up writing my own printstream / outputstream proxy (which was a fun experiment as the book gives no clue there) |
| 19:45 | duck1123_ | of course, I'm connecting to an already runnung clojure instance |
| 19:46 | dbudworth | ahh! the programming-clojure example ships with Clojure 1.1.0-alpha-SNAPSHOT |
| 19:46 | dbudworth | that repl doesn't work either |
| 19:46 | dbudworth | but does with 1.0 |
| 19:46 | dbudworth | and that's what I'm running with slime, the 1.1 snapshot |
| 19:47 | duck1123_ | I gave up on post 1.0 clojure when I started getting weird errors, and haven't needed any post-1.0 stuff |
| 19:48 | dbudworth | yep, 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:48 | duck1123_ | is that chunked seq stuff ready to go yet? It looked interesting, but haven't played with it. |
| 22:14 | Tulsi | hi |