#clojure log - Jul 23 2009

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

0:24 Anniepoo: Some architectural advice pls - I have a classic MVC pattern desktop editor that edits a bunch of rectangles

0:25 the rectangles will need to interact - they have a bunch of constraints one to the next

0:26 I've built the shell of the UI that does this, but am ready to add the model and start adding widgets

0:27 I know that this is the classic situation where it's hard to keep the view out of the model, cause there's all this current state info that the two have to interact on

0:28 So I'm trying to figure out how to make them play together better than Java allows.

0:28 anybody have a design pattern for this?

1:44 Jomyoot: If you will have lots and lots of updates. is hashmap in clojure much slower than Java hashmap?

1:51 Does Slime or any IDE support refactoring in Clojure yet?

2:02 mebaran151: your definition of lots is key

2:02 it's a log32 n datastructure as opposed to a constant time datastructure

2:02 so plan accordingly

2:12 duncanm: when using the PROXY form, is there a way to access the this pointer?

2:16 Mark_Addleman: chouser, thanks for the hint. i've got this now: (for [x (for [[p c] x] (map #(cons p %) c))] x)

2:17 that yields (((1235 0 17)) ((1236 0 15) (1236 16 8))) which is awfully close to what i want except for all the sublists. is there a function that will partially flatten that list?

2:21 fffej: ,'(1 , 2)

2:21 clojurebot: (1 2)

2:21 fffej: is there any way to get the "," as a symbol in the above expression? (e.g. an escaping like Lisps |,|)

2:22 Mark_Addleman: ffej: is this what you want: (interpose (symbol ",") [1 2]) ?

2:22 ,(interpose (symbol ",") [1 2])

2:22 clojurebot: (1 , 2)

2:23 fffej: perfect, thanks

2:25 Jomyoot: what is the macro to combine the result of (while something is ok) into a seq?

2:27 duncanm: Jomyoot: huh?

2:29 notostraca: filter?

2:29 not sure what you are asking

2:29 mebaran151: Jomyoot, reduce will do almost anything you want

2:30 Jomyoot: i can write this with loop and recurse

2:30 but hope something is already out there

2:32 zmyrgel: Where can I find the info how to build apps with clojure?

2:32 Jomyoot: is there good listing of all these (loop) (map) (while) (for) in one place?

2:32 duncanm: then it's probably reduce

2:32 zmyrgel: I don't mean the syntax, more in the way how functional programs are designed

2:33 fffej: try SICP or HTDP

2:33 duncanm: Jomyoot: can you show your code? if your'e doing it like that, you're probably not using the right combinators

2:33 zmyrgel: fffej: HTDP?

2:33 mebaran151: zmyrgel, Paul Graham's On Lisp is decent

2:33 duncanm: How To Design Programs

2:34 zmyrgel: ok, SICP has been on my to-do list for some time. I might be go with that

2:34 fffej: zmyrgel: they're both awesome books on designing functional programmes

2:34 zmyrgel: and you can watch the videos on your iPod

2:34 mebaran151: SICP is sort of the magic koolaid of programming

2:34 zmyrgel: :)

2:35 mebaran151: or the electric koolaid acid test if you would

2:35 everything from the 60's was just a little more farout

2:35 zmyrgel: One of the clojures nice features is that it works on platforms.

2:36 mebaran151: it's great to have a good lisp to suggest to people on Windows

2:36 what's the best way to run tests in Clojure

2:36 zmyrgel: I have been trying to get Haskell to work on my computers but it seems a losing battle

2:36 mebaran151: I'd love to be able to put them in the test dir of clojure project in netbeans and pound F11 until the pass

2:36 but I haven't figured out how to hook in the runner

2:36 zmyrgel, I once tried to compile it from scratch: and so lost 5 hours of my life

2:36 zmyrgel: well, theres some older haskell compiler present as the newer fail to compile or contain bugs

2:37 Otherwise Haskell would be pretty interresting language

2:37 mebaran151: the thing goes through a Perl mangler to optimize the bytecodes

2:37 zmyrgel: Has anyone read the Programming Clojure?

2:37 mebaran151: have you tried OCaml?

2:37 Ocaml tends to actually work

2:38 zmyrgel: I've installed it but haven't tried it

2:38 mebaran151: and it's in the same spirit as Haskell, with a little less ocd about purity

2:38 a colleague bought the Clojure Book

2:38 it's actually one of the better Pragmatic ones

2:38 Halloway wrote really clearly

2:38 much better than the Ruby reference

2:39 zmyrgel: Does the book have anything related to how design apps or does it focus on the syntax stuff that can be learned from wiki/tutorials etc?

2:41 wtf does that sicp contain?... Its priced 170 EUR on local bookstore

2:43 duncanm: zmyrgel: you can watch the online lectures instead, those are free

2:44 hiredman: clojurebot: sicp?

2:44 clojurebot: sicp is http://web.mit.edu/alexmv/6.001/sicp.pdf

2:44 hiredman: share and enjoy

2:44 zmyrgel: duncanm: I prefer good solid book for reading :)

2:44 hiredman: clojurebot: literal [?] sicp

2:44 clojurebot: 2

2:44 hiredman: clojurebot: literal [0] sicp

2:44 clojurebot: http://www.codepoetics.com/wiki/index.php?title=Topics:SICP_in_other_languages:Clojure:Chapter_1

2:45 hiredman: clojurebot: literal [2] sicp

2:45 clojurebot: 2 is out of range

2:45 duncanm: the lectures are really good, it's given by the same people who wrote the book

2:45 zmyrgel: At least Amazon has it cheaper

2:45 hiredman: clojurebot: literal [1] sicp

2:45 clojurebot: http://web.mit.edu/alexmv/6.001/sicp.pdf

2:45 hiredman: clojurebot: delicious

2:45 clojurebot: delicious is http://delicious.com/clojurebot

2:46 hiredman: clojurebot: sicp is also <reply>http://sicpinclojure.com/

2:46 clojurebot: Roger.

2:47 zmyrgel: How would you start web programming with clojure?

2:48 hiredman: clojurebot: compojure?

2:48 clojurebot: compojure is http://github.com/weavejester/compojure/tree/master

2:48 hiredman: I think compojure must be the easiest place to start

2:48 zmyrgel: can the jetty be replaced with Apache + tomcat?

2:49 hiredman: I am pretty sure compojure has been deployed in tomcat

2:49 zmyrgel: Good :)

2:50 I have more experience with that combo and my server has Apache as default so I don't have to make unnecessary changes

2:51 hiredman: easiest might be to just have apache proxy for jetty

2:51 which is what I am doing for my jetty install

2:51 but I really have not played with compojure in many months

2:52 zmyrgel: Gotta look into that once I get my new server up and running

2:52 should arrive tonight :)

2:52 more toys for me to play with :)

2:53 mebaran151: I just setup up compojure behind a jetty proxy

2:53 jetty is classy software

2:53 *jetty behind a lighttpd proxy

2:53 was actually a pretty smooth experience

2:54 you could even probaby just take advantage of the embedded jetty server, compile it as jar and never have to worry about any deployment stuff again

2:55 zmyrgel: ok

2:55 hmm, but now I think I need to focus why my script loses ~3k customers at some point...

2:57 mebaran151: loses 3k customers?

2:59 zmyrgel: parses customer data from our servers and now gets about 3k less than before

3:01 Jomyoot: i am naive here: but if each time you add a new item to hash map. it creates a new hash map. isn't that very expensive action then?

3:01 since a hash-map will be copied over and over

3:03 mebaran151: Jomyoot, hash maps in clojure are persistent

3:03 it uses the old hashmap as the basis of the new one

3:03 Jomyoot: is that the same for all collections in clojure?

3:03 mebaran151: yep

3:04 hiredman: Jomyoot: please checkout the clojure website, clojure.org, and in specific http://clojure.org/data_structures

3:04 ~bliptv

3:04 clojurebot: Titim gan éirí ort.

3:04 hiredman: bah

3:04 ~blip.tv

3:04 clojurebot: blip.tv is http://clojure.blip.tv/

3:05 hiredman: there are some good intro to clojure videos there

3:05 mebaran151: what's the nest way to turn a clojure map into a byte array?

3:05 duncanm: hey hiredman

3:05 hiredman: do you do any swing programming with Clojure?

3:06 hiredman: not much

3:06 very littel, in fact, but some

3:06 duncanm: i'm trying to follow some tutorial, but it requires extending a JComponent

3:06 i tried getting by with just using the PROXY form, but i can't get hold of the 'this' pointer

3:07 hiredman: duncanm: this is bound to the proxy object inside the fns implementing methods

3:08 duncanm: the keyword 'this' ?

3:08 hiredman: the symbol this

3:08 duncanm: right

3:08 hmm

3:09 hiredman: hmmm

3:10 yeah

3:10 user=> @(proxy [clojure.lang.IDeref] [] (deref [] (class this)))

3:10 clojure.proxy.java.lang.Object$IDeref

3:12 mebaran151: do you mean some kind of serialization process?

3:12 mebaran151: yep

3:12 right now I just string and read back in

3:12 (str myhashmap

3:13 hiredman: maybe prn-str and .getBytes

3:13 mebaran151: but I feel like there is probably a more efficient opcode built in somewhere

3:13 hiredman: nah

3:13 but use prn-str

3:15 mebaran151: currently doing that for my little bdb wrapper

3:16 you wouldn't happen to know the easiest way to simply deflate a string and reinflate it

3:16 the Java libraries seem to demand a lot of ceremony

3:16 hiredman: deflate? like compress?

3:17 mebaran151: yeah

3:17 as in the deflate algo

3:18 hiredman: dunno deflate, java has built in zip support since jars are just zips

3:20 jdz: also has a gzip support

3:20 don't know what you are talking, though

3:21 about

3:21 mebaran151: it has deflate built in too

3:21 I just haven't found a simple way to take a string and return gzipped version, and unzip that version

3:21 I was hoping there was an easier than way than having to manually manage the byte buffers all myself

3:22 hiredman: I have a wrapper for zipping and unzipping strings

3:23 mebaran151: oh, that sounds perfect

3:23 hiredman: http://gist.github.com/152502

3:23 mebaran151: thanks hiredman

3:23 hiredman: I haven't touched it in a while so there may be bitrot

3:23 mebaran151: it looks like a fine starting point

3:24 hiredman: well good luck

3:24 mebaran151: for all the bloat of Java libraries, I wish they'd provide more convenience methods

3:24 hiredman: heh

3:25 jdz: http://paste.lisp.org/display/68935

3:26 lisppaste8: jdz pasted "my current version" at http://paste.lisp.org/display/84048

3:27 mebaran151: I'm still trying to figure out the best place to put tests too

3:28 I'm using the rather excellent enclojure plugin, but I'm not sure how to integrate it with Junit or not

3:28 I'm debating doing it old school python style, putting them as executable code at the bottom of my file that will only be evaluated if a special variable is set, but that feels pretty hack

3:28 hiredman: test-is just got moved from contrib into clojure under clojure.test

3:29 mebaran151: how would I run test-is under junit?

3:29 hiredman: dunno

3:30 mebaran151: I also have an async http agent implementation using apache commons that works a lot better than the http agent in clojure.contrib

3:30 could a clojure contrib library have a dependency outside the standard library?

3:30 hiredman: some of it does

3:30 contrib is kind of a sprawl

3:31 or I think it does, I don't really keep up with contrib

3:31 ataggart: avoiding external deps would be a good thing

3:32 mebaran151: I'll be putting up some stuff on github pretty soon that I'd be happy to share

3:32 async io in Java though can be really nasty with some common sense wrapping

3:33 clojure could use a nice package manager: rubygems spoiled me

3:35 *without some common sense wrappings

5:00 I'm getting a strange error: can multimethods be used within macros?

5:03 gulagong_: hi

5:03 lisppaste8: ataggart pasted "Updated contrib logging" at http://paste.lisp.org/display/84053

5:04 gulagong_: i want to combine -> with map - any better solution than #(map %2 %1) ?

5:08 mebaran151: I'm getting this weird error when I nest two macros: can't embed object in code: maybe print-dup not defined

5:10 gulagong_: is there a possibility to beautify this? (-> '(1 2 3 4) (#(map %2 %1) #(inc %1)))

5:12 AWizzArd: ,(-> '(1 2 3 4) (#(map %2 %1) #(inc %1)))

5:12 clojurebot: (2 3 4 5)

5:12 AWizzArd: what is wrong about

5:12 ,(map inc [1 2 3 4])

5:12 clojurebot: (2 3 4 5)

5:13 gulagong_: ok... increasing is not really what i want to do :)

5:13 Chousuke: my best advice is: don't

5:13 gulagong_: i want to map a bunch of complex operations on a map

5:14 AWizzArd: gulagong_: good ideas are: reduce, for, loop.

5:14 Chousuke: use comp?

5:14 (map (comp op1 op2 op3 op4) coll)

5:14 AWizzArd: loop and reduce can do anything, but loop can be cleaner for very complex stuff.

5:14 gulagong_: oh, cool

5:14 AWizzArd: map and filter are only special cases of reduce.

5:14 gulagong_: comp looks like what i want

5:14 thx :)

5:14 jdz: gulagong_: there's also partial

5:36 Fossi: does anybody here know what the 'CA' is, that is needed to get into the clojure Assembla thing?

5:37 Certificate Authority?

5:37 but then, what's the deal with that?

5:38 rottcodd: http://clojure.org/contributing

5:39 Fossi: ah, ok. that makes more sense

5:45 gen-html-docs: "* Figure out why the source doesn't show up for most things"

5:46 i have that exact problem when running from console. i really wonder what the fix was supposed to be

5:46 i guess it's time to dig into the logs

5:51 too bad the import into contrib lost the history of whereever it has been developed before...

6:00 deriksson: Why is there an asterisk in duck stream's "slurp*"? Is this a convention or a way of avoiding collisions with "slurp".

6:16 rottcodd: deriksson: in common lisp, there is a convention that f* a variation of f

6:16 deriksson: thanks, rottcodd!

6:40 djpowell: anyone know much about the jmx stuff in contrib?

6:55 fsm: Hello everyone.

6:55 AWizzArd: Hi fsm, how is that Raytracer going?

6:55 fsm: Here is my Clojure raytracer source code.

6:55 http://tu.be/graphics/tracer.zip

7:07 Thorn: fsm: seems about as fast as povray

7:10 vector math in lisp looks pretty painful

7:12 fsm: The vector math in clojure is OK

7:12 You can basically use java primitive arrays

7:12 Unfortunately you cannot use SSE so that is the bottleneck

7:13 AWizzArd: Can Java code use SSE?

7:13 fsm: You can use it via JNI calls

7:14 but for operations on small vectors, the JNI overhead kills it

7:14 plus, the data has to be allocated on the native side so it is word-aligned properly

7:14 (at least that is my understanding)

7:15 If you are in C/C++ you can use the intel performance library where common 3d operations are practically a cpu instruction

7:15 (again at least that is my understanding)

7:21 Thorn: I wonder if CUDA can be efficiently used from jvm

7:23 AWizzArd: rhickey: do you currently (mainly) work on data parallelism for Clojure? Some days ago I read something from you about parallel vectors, etc.

7:23 Thorn: yeah, that would be very very interesting. I would so very much like to have a way to run some Clojure functions on my video card.

7:24 rhickey: AWizzArd: parallel map and reduce (pvmap and pvreduce) for ordinary Clojure vectors is up now in the par branch

7:24 AWizzArd: ah ok, so the par branch is what I want :)

7:25 rhickey: AWizzArd: check the irc log from yesterday - I described how to get going with it

7:27 AWizzArd: k

7:28 Thorn: AWizzArd: whatever code you need to run on video card using cuda you'd need to compile it into their C dialect if I'm not mistaken

7:35 fsm: I believe it is standardising on OpenCL

7:37 What is the execution time for that example render on your machine, out of interest?

7:38 AWizzArd: Thorn: yes, for today this is true. But there may be limited compilers from Java Bytecode to Video_Card_Bytecode, or they may be JREs in the future, running on video cards.

7:39 Thorn: fsm: 75.8 sec, 2111 pixels/sec (cpu is Q9300)

7:40 AWizzArd: what about architecture differences between CPUs and GPUs? is it even possible?

7:40 fsm: Hm, I am 173 seconds on macbook pro 2.53ghz

7:41 Thorn: linux 64-bit, jdk is sun 1.6.0.14

7:42 djpowell: did you use "java -server"

7:42 Thorn: nope, I'll rerun with it

7:43 djpowell: i get 93.8 seconds on a quad core q6600, with -server

7:43 Thorn: 76.7 sec with -server

7:52 fsm: Thanks everyone, goodnight.

7:53 Thorn: hm, http://www.jcuda.org/

7:56 AWizzArd: Thorn: I don't think that with todays technology it is possible to have a (nearly) full JRE on video cards. But that may change in the next years.

7:56 Perhaps before 2020 it will be possible.

7:57 This is not "soon", but still close enough.

8:14 rhickey: we hit 20000 messages on the Google Group!

8:22 * AWizzArd cheers

8:26 sgtarr_: I see there is an upcoming OReilly LISP book

8:27 It'll cover CL and Clojure

8:27 Sweet!

8:36 AWizzArd: sgtarr_: link?

8:39 rottcodd: http://enlivend.livejournal.com/tag/book

8:42 AWizzArd: thx

8:56 Fossi: anybody know by chance who 'nt' is: http://markmail.org/message/fnzwqaa7lxbyme4i#query:log-info%20clojure+page:1+mid:fnzwqaa7lxbyme4i+state:results

8:57 and/or where the logger code is from

9:01 duck1123: I can't believe that a book like that is going to put clojure off to chapter 31

9:02 achim: hi all!

9:02 lisppaste8: url

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

9:03 rsynnott: duck1123: well, it seems to be primarily about common lisp

9:03 duck1123: fair enough

9:03 lisppaste8: achim pasted "arities" at http://paste.lisp.org/display/84063

9:03 rsynnott: (it seems to be taking an odd approach; slime introduced in chaper 18?)

9:03 achim: is there a less hackish way than this to retrieve the arities of a fn?

9:04 rhickey: duck1123: I don't have high hopes for its coverage of Clojure - we'll see

9:05 duck1123: any press for lisp is good, I guess

9:05 rsynnott: "The rest of the book revolves around specific proprietary and non-proprietary libraries; each part focuses more or less on a different lisp implementation: Allegro, Clozure, SBCL, LispWorks, Clojure." - that just sounds silly

9:06 Chouser: achim: that's brilliant

9:06 durka42: rsynnott: what struck me as strange about that sentence is that all of those (except clj) are CL implementations

9:06 rhickey: Kind of a shame that when OReilly finally gets around to a Lisp book it's about old Lisp, and having done that they will probably be even less likely to do a Clojure book

9:07 Chouser: achim: a better approach by far than any I've thought or heard of.

9:07 rsynnott: the difference between various implementations of common lisp and one non-CL thing seems a strange thing for such a book to cover

9:07 duck1123: I hope OReilly puts out a clojure book

9:08 achim: Chouser: but it feels ... wrong! :)

9:09 Chouser: achim: I'm not really saying it isn't, but it's a brilliant hack.

9:10 rsynnott: achim: as a matter of interest, why do you want to get arities of a function at runtime?

9:10 duck1123: what seems wrong about it? It seems pretty clear.

9:10 Fossi: it's kinda implementation specific though

9:10 at least the 'invoke' part

9:19 achim: rsynnott: i wanted it for debugging a while ago, but the question, how to do it, outlived the bug ;)

9:22 rsynnott: ah :)

9:26 Fossi: AWizzArd: afaik some shader languages are turing complete, so it should be possible to implement a jre. just a pita

9:33 kylesmith: I need to calculate the nearest neighbors within a specified cutoff radius. Switching from the N^2 brute force method to a NlogN binary space partition tree got me a 5X performance improvement. There are structures called "cell-linked lists" which could be faster. Can anyone advise me on this, or should I just code it up and compare?

9:51 cemerick: wow, O'Reilly gave the green light to a new CL book http://lisp-book.org/

10:02 AWizzArd: cemerick: sgtarr_ mentioned it nearly 2 hours ago :p

10:03 cemerick: I guess I'm behind the times

10:03 drewr: no, just behind the time zones

10:08 AWizzArd: Is there something simple that lets me leave out the class for calling a static method? So instead of (or (Character/isSpaceChar %) (Character/isWhitespace %)) I would "import" isSpaceChar and isWhitespace.

10:09 drewr: defn or defmacro

10:10 Chouser: clojure.contrib.import-static

10:10 AWizzArd: clojure.contrib.import-static

10:11 AWizzArd: good

10:14 drewr: whoa

10:14 * drewr wonders why he tries to help

10:49 Chouser: drewr: ?

10:55 drewr: Chouser: that was more tongue-in-cheek than it sounded

11:00 Chouser: oh, I see now. Sorry, I actually just misunderstood the topic at hand

11:06 Lau_of_DK: Does S Halloway camp here regularily ?

11:07 drewr: Lau_of_DK: couple times a week maybe; not too often

11:07 cemerick: whoo-wee, perst appears to be pretty nifty (yeah, I'm still OT on key-value stores)

11:07 Lau_of_DK: drewr, thanks

11:07 stuartsierra1: I'm on an RDF kick again, heaven help me: http://github.com/stuartsierra/clojure-rdf

11:09 duck11231: stuartsierra1: You're going to go with a fresh implementation?

11:10 stuartsierra1: Well, I'm trying to define an abstract API that is pure Clojure, then add various Java libs as back-ends.

11:10 duck1123: I did some work on a clojure wrapper for jena, but i abandoned it to go a different way

11:11 stuartsierra1: I did the same thing with Sesame a couple of years ago, and abandoned it as well.

11:11 rhickey: stuartsierra1: how did you find Sesame?

11:12 stuartsierra1: Not bad, nicer API than Jena, but too slow for my purposes.

11:12 rhickey: using the native store? with how many triples?

11:13 stuartsierra1: Yes, the native store, with a few hundred thousand triples.

11:13 It wasn't the retrieval times that were too slow, it was bulk load/deletes.

11:14 rhickey: I've just started looking at Sesame and Open Link Virtuoso

11:14 stuartsierra1: Virtuoso is definitely interesting, haven't tried it.

11:15 duck1123: a clojure library for working with talis would be kinda cool

11:39 stuartsierra1: How can I un-import a java.lang class from a namespace?

11:41 (ns-unmap *ns* 'Class)

12:17 Fossi: how in hell do you create an ordered list?

12:18 without having to cons all the items together

12:18 Chouser: easier to do when not in hell.

12:18 ,(list 1 2 3 4) ?

12:18 clojurebot: (1 2 3 4)

12:18 cemerick: heh

12:18 Lau_of_DK: Fossi: Dont let Chouser catch you swearing in #Clojure, he'll not be merciful

12:18 Fossi: Lau_of_DK: i noticed

12:18 rzoom: Fossi: can't be done. hell doesn't have clojure

12:18 Chousuke: D:

12:19 Lau_of_DK: Hell might have Python though, so look into that

12:19 Chouser: Fossi: is 'list' what you wanted there, or are you asking for something else?

12:19 Chousuke: rzoom: it does, but it has no immutable collections.

12:19 Chouser: Chousuke: ouch

12:19 Fossi: so, if in a macro, how can i "(list "foo" (func ~some-param))"?

12:19 hmm or wait

12:20 Chouser: , `(foo ~@(list 1 2 3))

12:20 clojurebot: (sandbox/foo 1 2 3)

12:20 Chouser: ,(cons `foo (list 1 2 3))

12:20 clojurebot: (sandbox/foo 1 2 3)

12:20 Fossi: yeah, i'm more or less just being stupid

12:20 the macro was right, just the usage was off

12:21 Chouser: np... writing macros can put you in a weird state of mind.

12:21 Fossi: macros have to be the most "horrible" thing language feature ever apart from monads maybe

12:22 but then again... so tempting :D

12:22 Chousuke: horrible? syntactic abstraction is horrible? :)

12:22 Lau_of_DK: Agreed Fossi - Macros hurt people

12:23 Chousuke: people hurt people!

12:23 Fossi: it horrible to wrap your head around

12:23 actually it feels more like being wrapped around it

12:23 Chousuke: Fossi: a macro is just a transformation function

12:23 * Fossi does the twist

12:23 Chousuke: Fossi: its arguments are clojure data structures, and its output is clojure code.

12:23 that's all.

12:23 Fossi: yeah, yeah. i get the concept

12:23 Chouser: monads help you work around restriction you or the language are putting on yourself

12:24 Lau_of_DK: Chousuke: Its like Rocket science - You've got your rockets and your science... that's all.

12:24 Chouser: macros let you write code that would otherwise be impossible

12:24 Fossi: but with flexible parameter lists and wanting to do something to those you get into a lot of strange "code" sooner or later

12:25 Chousuke: complex macros can be difficult, but I don't really see them as any worse than complex functions.

12:26 clojure's macro system is nice in that it's pretty difficult to accidentally write a "bad" macro.

12:26 Lau_of_DK: Chousuke: Funny, I dont have that much trouble with it :)

12:26 Chousuke: writing bad macros? :P

12:28 Lau_of_DK: Yea

12:29 Chousuke: Well, I usually end up with a macro that doesn't work rather than one that works but breaks your code in mysterious ways if accidentally used in the wrong environment.

12:30 Fossi: yeah, common lisp mine tend to go bad like that

12:30 *in

12:31 Lau_of_DK: But for a fantastic shiny example of macros used in the right way - I encourage everybody to check out ClojureQL

12:31 mebaran151: what's the best choice for simple light full text search for clojure: is Java the main option

12:33 Lau_of_DK: mebaran151: full text search ?

12:33 mebaran151: *lucene

12:33 I just want a full text search addon to complement some stuff I'm doing in BerkeleyDB

12:34 that's why it would be nice if it were light

12:36 stuartsierra1: full-text search isn't really a "light" problem :)

12:37 duck1123: Clojure has made me a snob when it comes to the literal representation of deeply nested series hashmaps and vectors

12:38 I'm dealing with PHP right now, and I want to re-write this data

12:39 Fossi: mebaran151: what's wrong with lucene?

12:39 mebaran151: it always just seemed a little clunky

12:40 thought that maybe since I'd been away, the Java world had developed something better

12:40 Fossi: does the job for me

12:40 on a pretty good scale as well

12:40 mebaran151: it's good to hear that

12:40 I using solr, which never seemed too inspirational

12:41 technomancy: lucene's API is pretty sane.

12:44 cemerick: mebaran151: compass is interesting, insofar as it tries to eliminate the datastore/FTI mismatch

12:44 mebaran151: I'll check it out

12:45 yeah, I have basic inverted word index running on top of bdb, but it seems like including something more sophisticated would be nice

12:45 cemerick: the disappointing thing about it is that it really wants to be hooked into JPA, and (primarily) uses annotations to determine what fields to index in your object model.

12:46 mebaran151: I'm eval'ing perst right now, which has baked-in fulltext, as well as lucene integration. So far, so good.

12:46 mebaran151: the thing that was most disappointing about most of these utilities was they required me to fix the field types up front, which is a no go for this project

12:47 oh perst does look pretty nifty

12:48 drewr: bledg

12:49 wrong window

12:49 i think my laptop keyboard is going out

12:49 cemerick: mebaran151: yeah -- the spec page had me saying "oh, yeah, right!", but so far, it's working out nicely.

12:50 mebaran151: what's their license like? is it similar to berkeleydb, where if it stays on your own sever, you're covered?

12:50 cemerick: yeah, it's GPL, or commercially-licensed

12:51 I'm particularly interested in seeing if its lucene FTS works out nicely -- being able to have the DB and FTI in one file will be huge.

12:51 * cemerick has been looking for something like that for ~5 years

12:52 mebaran151: that would be really nice

12:52 cemerick: lucene has a BDB backend, but the benchmarks I saw for it aren't pretty

12:53 mebaran151: bdb usually seems pretty performant

12:53 cemerick: yeah, I'm sure it has far more to do with the lucene Directory impl

12:54 mebaran151: that surprises: it's a fairly light layer over simple btree disks

12:54 an even my naive downcase, split words and attach to secondary index actually worked out pretty well

12:56 shoover: ThruDB has a key-value database and full text search via Thrudoc and Thrudex. When I looked, it felt like bdb with a simpler api. New BSD license. http://code.google.com/p/thrudb/

12:56 Oh, it's client/server. Maybe you need embedded

12:56 mebaran151: I'd like to embed this

12:56 cemerick: yeah, embedded is a major constraint

12:57 shoover: thanks though, hadn't seen thudb

12:57 thrudb*

12:57 mebaran151: well I also like to have control of my data: for backing it up and what not

12:59 also if you don't need multiple processes hitting the db

13:00 shoover: mebaran151: you would control your data

13:00 mebaran151: oh its not like an amazon service?

13:00 shoover: no, it's client/server but you run both

13:01 I bet the server only runs on unix, but it looks like they're working on a java implementation of that too

13:01 mebaran151: ah that's a little better but the added complexity of client server rarely seems worth it, and it hurts performance on smaller deployments to pay for the IPC when you only have one process

13:07 * stuartsierra1 added RDF/XML parsing using Jena, http://github.com/stuartsierra/clojure-rdf

13:18 hserus: has test-is been moved out of contrib recently?

13:18 stuartsierra1: yes, now it's clojure.test

13:18 hserus: ah, ok.. thanks

13:19 Chouser: hserus: also some changes to the 'are' syntax

13:19 hserus: will check it out

13:24 replaca: does anyone understand why JSON strings seem to want \ before /?

13:24 do they really care?

13:25 danlarkin: I don't think / needs to be escaped, does it?

13:26 Chouser: I wouldn't think so

13:26 not listed at json.org

13:26 hm, though it is accepted.

13:26 danlarkin: well that makes sense

13:26 escaped slash is slash

13:26 Chouser: escape b is backspace

13:27 danlarkin: I think all non-control characters escape to themselves, right?

13:27 replaca: yeah, it's accepted but it doesn't say what's "required" that's what confused me

13:29 why would it even be "accepted"? If you look at the grammar at json.org, it doesn't seem to allow anything to be escaped, but it explicitly includes /

13:29 hserus: where can i find clojure.test? dont seem to be able to find it

13:29 Chousuke: hserus: it's only in git clojure right now

13:29 ieure: replaca, For some reason, lots of people escape forward slashes in JSON. I don’t know why; it’s not necessary, as far as I know.

13:29 replaca, I just string-replace them back to / before deserializing.

13:30 Chousuke: hserus: if you need to use test-is with 1.0.0, use the 1.0.0-compatible branch of clojure.

13:30 hserus: Chousuke: thanks

13:30 Chousuke: hserus: er, contrib

13:30 replaca: weird

13:31 ieure: replaca, Yeah. It’s really dumb. This has a quasi-reasonable rationale: http://tech.groups.yahoo.com/group/json/message/249

13:32 Though I think that’s an example of Doctor It Hurts When I Do This.

13:32 replaca: stuart was escaping it in c.c.json.write and I copied that for my pprint json disspatch func, but now I'm wondering if it's necessary

13:32 ieure: Why would you want to put HTML in a JSON-encoded string in a <script> in HTML?

13:33 replaca, I think it’s very slightly safer to escape it, but most decoders won’t _unescape_ it. Which blows.

13:34 replaca: OK, I understand the rationale at that link: a JSON string is at it's core a javascript string and javascript strings have HTML in them quite often.

13:34 But that makes me think that I *don't* want to escape it here.

13:36 thanks for the pointer, ieure!

13:36 ieure: No problem. I ran into it a while back when I was working with the Twitter streaming API.

13:37 It definitely doesn’t make sense for that.

13:41 cschreiner: I am looking at the clojure-src-root variable in emacs

13:42 how important is this for slime /et al to work correctly? It says: Directory that contains checkouts for clojure, clojure-contrib, slime, and swank-clojure. This value is used by `clojure-install' and `clojure-slime-config'.

13:42 technomancy: cschreiner: if you don't use that you can still configure slime manually

13:42 but it's more complicated

13:42 cschreiner: ok

13:43 I guess there are some features I am not using in slime

13:44 technomancy: nobody uses all the features of slime. =)

13:44 lisppaste8: Anniepoo pasted "drawString" at http://paste.lisp.org/display/84077

13:45 Anniepoo: this is unhappy (.drawString g #^String str xpt y)

13:45 g is a graphics, drawString has an override that takes 3 args with some iterator fancy text thingy

13:46 so I'm trying to type hint to tell awt that the first (java) arg is a String

13:47 it's not working. Annie is sad, and feels like she should go back to making hammurabi in BASIC

13:48 Raynes: Don't be drastic!

13:48 Anniepoo: (swap! Annie #(set-drastic % false))

13:49 so, what's wrong with my type hint?

13:49 Chousuke: hmm

13:50 looks like the method takes ints too

13:50 tried wrapping xpt and y in (int ..)?

13:50 Anniepoo: nope

13:50 wrapping? so (int xpt) ??

13:50 Chousuke: yeah

13:50 Anniepoo: is the return of str type hinted like that?

13:51 Chousuke: hm? no, it's just telling clojure that xpt and y should be native ints and not Integers

13:51 though it should happen automatically :/

13:51 * Anniepoo wonders how you type hint the return

13:51 Chousuke: the String type hint for str should be okay.

13:52 Anniepoo: the int fixed it

13:52 (.drawString g #^String str (int xpt) (int y))

13:54 cemerick: fwiw, that likely only failed because xpt or y aren't ints already (or java.lang.Integers)

13:55 Anniepoo: ah, they're the result of (/ i-am-int 2)

13:55 cemerick: right, so if i-am-int is 3, then the result of that is a Ratio, for which there isn't an obvious conversion to int

13:57 Raynes: If Rich Hickey was God, would Chris Houser be Jesus Christ?

13:57 danlarkin: wow, that is a bold statement

13:58 ataggart: quite

13:58 Raynes: I went there.

13:58 ataggart: what's the trick to submitting a ticket via assembla? My CA has been accepted, I'm logged in, I'm watching the clojure anc lojure-contrib spaces... yet I can't find any way to do it.

14:00 cemerick: ataggart: there should be a big "new ticket" button at the top of the "tickets" tab/page

14:01 ataggart: not that I see

14:01 lpetit: ataggart: have you already asked for being enabled on assembla ?

14:01 ataggart: ah I see it there in clojure, but not clojure-contrib

14:02 lpetit: ataggart: as a member of the assembla spaces ? (not just a public reader)

14:02 ataggart: I'm unclear on the distinction

14:02 do I need to do something other than "watch this sspace"?

14:02 cemerick: ataggart: a project admin has to enable you as a contributor (or something, not sure of the terminology)

14:02 lpetit: dunno

14:03 ataggart: if nobody here can do it, then you'll have to ask for it at clojure-dev@googlegroups.com

14:04 ataggart: ok thanks

14:08 lpetit: Is there a way to easily handle a state for a proxy instance, as is done for gen-classed instances ? Currently, I must resort to something like (let [state (atom {})] (proxy [SomeClass] (someMethod [] (... (swap! state assoc :some-key some-value))))

14:08 ?

14:10 hiredman: lpetit: looks good to me

14:12 lpetit: hiredman: well, yes, but I thought there were a possibility to have more uniformity between proxy and gen-class here. There also the problem that it's not easy to initialize the state (or call super-class methods via (proxy-super)) at construction time

14:14 Chouser: ataggart: you should be able to create tickets using the "support" tab

14:14 lpetit: I'm in a situation where I want to avoid having to use AOT compilation because I want to introduce clojure without having all my collegues having to add (yet) clojuredev to their eclipse (introducing clojure from the back door)

14:14 Chouser: lpetit: you're doing it right.

14:16 lpetit: Chouser: how would you simulate finishing initializing the proxied instance ? By just calling methods on it after having created it ? What if for terminating initialization I have to call super class methods that I then override ?

14:19 Chouser: proxy is definitely missing desirable features (newnew, come quickly) so it's possible you may not be able to do what you want.

14:19 but yes, your instincts are sound

14:20 a common model for using proxy is something like (defn make-foo [args] (let [some-state ...] (proxy [AClass] [args] ...)))

14:20 lpetit: chouser: ok, I'll wait then, no problem :-)

14:21 Chouser: so if you need to call some methods on the proxy instance before make-foo returns it, you can toss a doto around proxy inside the let

14:23 if you need to call methods of the superclass that are hidden by your own overrides, you may be able to use proxy-call-with-super

14:23 note that's not thread-safe, but should be ok in the context of make-foo

14:25 lpetit: Oh I didn't know about proxy-call-with-super, I was missing this part, thanks.

14:27 cemerick: lpetit: note that the super-method you call won't invoke any methods you've overridden in your proxy, if you happen to be extending a concrete class

14:28 hiredman: http://spanx.wordpress.com/2009/07/23/clojure-robot-on-google-wave/

14:29 lpetit: is proxy-call-with-super a post 1.0 fn ? I can't see it in the current clojure.org doc site ?

14:30 non ok I see it in the jar

14:31 cemerick: it would be *very* convenient if the core values / collections in clojure were Serializable

14:31 (I know that might get dicey in certain areas)

14:33 lpetit: cemerick: are you sure about what you say concerning the super-method that won't invoke any methods overriden in the proxy ?

14:34 Chouser: lpetit: it has no doc string. I guess you're expected to use the proxy-super macro, but that captures 'this which may not be appropriate in your case.

14:34 cemerick: pretty sure. I got burned by that recently...called super.foo(), which called bar(), overridden in my proxy. The proxy's impl never saw that call.

14:34 maybe that's different since 1.0?

14:35 Chouser: huh, I wonder if proxy-call-with-super should use try/finally so it doesn't lose the proxy override if there's an exception.

14:35 bleh, it's such a hack anyway...

14:35 lpetit: I read the code of proxy-call-with-super, and it's just removing the mapping for the method to make the super's method visible again, not touching other overriden methods

14:37 chouser: yeah, it's a hack. Wondering how it would work if the method launches a work in another thread ... and the call to the super class method is done lately from the thread, that could lead to interesting bugs or infinite loops, wouldn't it ?

14:37 Chouser: yes, not thread safe.

14:38 the behavior of that particular proxy object (not the whole class) is temporarily changed in a way that is 'visible' to all threads.

14:38 newnew come quickly...

14:39 cemerick: agreed. It will make so much possible.

14:39 lpetit: cemerick: OK I now remember the problem. But it's not related to using proxy-call-with-super, I think ? It's the same kind of problem one has with spring AOP when not using Aspect J : if the class makes a reflexive call, no AOP injected behavior will happen

14:40 chouser: yes, not thread safe, not resisting exception throwing, it's a can of worms right now ...

14:40 cemerick: I never had the (dis?)pleasure of using spring or aspectj. I encountered the issue when using processing, which is compiled for java 1.4 *shrug*

14:41 It's entirely possible that I was doing something wrong, of course. :-)

14:46 lpetit: cemerick: I'm sorry, but I finished writing my proxy, and I have overriden some methods that are known to be called from the super class, and it works correctly.

14:47 cemerick: excellent

14:47 just to be clear, I hit my problem when a proxy-super call would directly cause a call to an overridden method

14:47 lpetit: cemerick: ok, I didn't test that

14:52 what is the state of this newnew operator ? Is there somewhere some doc or an early implementation ?

14:53 Chouser: lpetit: http://www.assembla.com/wiki/show/clojure/New_new

14:53 lpetit: thx

14:53 Chouser: no implementation that I'm aware of.

14:55 cemerick: Rich is going to blow in one morning, and say, "hey, check it out the initial newnew impl", after having said the night before that he hasn't started in on it yet. :-)

14:55 ataggart_: master of managing expectations

14:56 Chouser: not just that he hasn't started it yet, but that there's some deep internal requirement clash

14:58 the morning's implementation will be based on a design that solves all key requirements, but looks only vaguely like the design suggested in the New_new doc

14:59 lpetit: not that it is bad, though :)

15:00 cemerick: huh, we're edging up again...

15:00 ~max

15:00 clojurebot: max people is 164

15:01 lpetit: ~min

15:01 clojurebot: is_rhickey_a_minor_god is yes

15:02 lpetit: ;)

15:02 Chousuke: :P

15:02 ataggart_: http://www.google.com/trends?q=clojure

15:03 cemerick: hrm. Scary amount of literal idolatry today.

15:03 ataggart_: what's up with Norway?

15:03 * technomancy glances at Chousuke

15:03 technomancy: one-man-search-army?

15:03 * Chousuke is Finnish

15:03 drewr: props to rhickey for a search-friendly name

15:03 technomancy: oops! sorry. =\

15:03 cemerick: ut-oh!

15:03 drewr: ouch!

15:03 cemerick: technomancy: thanks, I needed that! ;-)

15:04 drewr: scandinavia looks like one country from all the way over here

15:04 cemerick: man, and Austin is beating Boston? Lisp capital of the world? *sigh*

15:04 Chousuke: Technically, Finland isn't part of scandinavia either. ;P

15:04 but everyone forgets that.

15:04 * technomancy has some swedish blood, but I don't think Google trends knows that

15:04 Chousuke: even Finns

15:04 drewr: haha

15:04 ataggart_: It's part of Russia, right?

15:04 ;)

15:05 cemerick: And Korean is the top language? Something very odd about these rankings.

15:05 danlarkin: cemerick: it's the illusive Korean Norse

15:05 cemerick: ataggart_: there lie dragons.... :-D

15:05 drewr: clojure is probably being used in nuclear projectile telemetry

15:07 Chousuke: Incidentally, the Finnish name for Norway is Norja, which also happens to be a word that means "(physically) lean" and Korea is also Finnish, means something that is well-decorated :P

15:07 cemerick: ...and if you choose either Korean nation, you get no results.

15:07 Chousuke: so, of course people are searching for something lean and beautiful.

15:07 * cemerick doubts all google trends data now

15:08 cemerick: Chousuke: yours is the land of sauna, right?

15:08 * danlarkin realizes he missed the opportunity to use a great pun, "Norse Koreans"...

15:08 technomancy: I guess that spike was the 1.0 and book release?

15:08 Chousuke: cemerick: yeah

15:08 cemerick: that's what I thought

15:08 * ataggart groans at the pun

15:09 Chousuke: danlarkin: maybe they were the ones that did the DDoS attacks a while ago. :/

15:09 danlarkin: and at the same time, spammed Google with clojure searches

15:10 danlarkin: They used agents to perform the attacks :o

15:12 technomancy: http://www.evri.com/product/clojure-0x151efb <- my former employer's profile page for clojure

15:13 they do NLP news analysis... has some interesting links

15:13 whoa; a second book? http://www.amazon.com/Definitive-Guide-Clojure-Luke-VanderHart/dp/1430272317%3FSubscriptionId%3D1BRRVPQYSE5BWCE26RG2%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1430272317

15:14 cemerick: wow, neat!

15:14 technomancy: from apress... they published practical CL

15:14 cemerick: Luke VanderHart? "...a very active member of the Clojure community..."

15:14 paging Luke?

15:15 nm, found him on the group

15:17 technomancy: it's also going to be covered in the O'Reilly book on CL

15:19 * angerman tries to figure out why he cannot intall clojure via clojure-install using emacs

15:19 technomancy: angerman: what's up?

15:19 lpetit: technomancy: poor laptop !

15:19 angerman: Clojure installation step failed: git clone git://github.com/kevinoneill/clojure.git

15:19 technomancy: angerman: looks like you've got an old version of clojure-mode

15:19 angerman: technomancy: that's up :/ I do have git. I guess it fails to find it ..

15:19 technomancy: time to update

15:20 angerman: technomancy: I took the one from elpa just a few secs ago

15:20 technomancy: angerman: oh.... my bad. I need to send the updated version to elpa

15:20 angerman: says v. 1.1

15:20 technomancy: get it from http://github.com/technomancy/clojure-mode for now.

15:20 angerman: can I simply overwrite the one elpa installed?

15:20 technomancy: sure

15:21 thanks for the reminder; /me sends off an update

15:21 angerman: should I take the slime install from the clojure mode or the one that aquamacs wants me to install from the aquamacs website?

15:22 Anniepoo: I like evri, hope being a former of it isn't a bad thing.

15:22 * angerman wonders how long elpa takes to update their repositories

15:22 technomancy: angerman: I don't know much about aquamacs... I think it's better to use the one from git.

15:22 angerman: it's still a manual process unfortunately. =\

15:23 angerman: hhmm ..

15:23 technomancy: Anniepoo: they had to do some cutbacks a few months ago but are still afloat. =\ but I get to work in Clojure now. =)

15:23 fogus: I use clojure-mode without problems in Aquamacs

15:23 angerman: hmm feels better

15:24 fogus: dunno I had an issue with it using git .

15:24 * angerman wonders what he's required to do after this all is done.

15:24 technomancy: Aquamacs has some tricky edge-case incompatibilities, and I can't test it since it's not portable.

15:25 but if it works for you that's great

15:25 angerman: no ... No such directory found via CDPATH environment variable

15:25 technomancy: here I am, your testcase :p

15:26 Anniepoo: @technomancy, Ah, then it's a good thing!

15:28 technomancy: angerman: can you paste the steps you took and the contents of the *Messages* buffer as well as any other error messages?

15:28 angerman: technomancy: it's git again

15:28 but I'll past it

15:29 technomancy: angerman: if you do M-x eshell, can you run git?

15:29 just try git -v or something

15:29 angerman: github's so slow :/

15:29 technomancy: it only failed on slime

15:30 http://gist.github.com/153465

15:32 technomancy: angerman: that's very strange... it looks like it might be related to aquamacs hacks

15:32 angerman: you should be able to manually check out slime in the clojure-src-root directory if you want to try again without re-downloading everything

15:33 then put "(clojure-slime-config "/path/to/clojure-src-root/")" in your config somewhere

15:33 angerman: i'll try once more

15:34 technomancy: maybe you could split the install process into a download and a compile and rest function

15:34 that way if the download fails, one could just continue with the compilation after fixing it by hand

15:35 technomancy: not a bad idea

15:37 I need to get it to AOT contrib too

15:39 angerman: the Error arose from the (dolist (repo clojure-last-known-good-revision) ....

15:41 technomancy: angerman: oh... I may have messed something up.

15:41 cemerick: hrm, Delay needs an isForced method or somesuch

15:42 angerman: whee, now I a working slime

15:42 technomancy: I did a shallow copy of slime so it wouldn't take forever, but that may have missed the last-known-good revision for swank-clojure

15:42 angerman: technomancy: well if reporting bugs helps, whee :)

15:42 technomancy: genius

15:42 angerman: technomancy: well wait

15:42 technomancy: I did just install git clone --depth 2 ... slime

15:42 and then commented everyting out of clojure-mode till the compilation step and rand clojure-install again

15:43 now it works

15:43 dunno about swank so ... how would I test?

15:43 technomancy: just do M-x slime

15:44 angerman: does work.

15:44 technomancy: wonder if there's a way to make a shallow clone in git starting from a given revision...

15:45 I guess I could just make my own fork and only update it when I've tested it with swank.

15:45 that sounds easier

15:46 angerman: technomancy: well as I said that CDPATH issue came from the (dolist (repo ... )) part between the git clones and the compiling

15:47 how would I add additional jars?

15:47 e.g. if I want to use compojure, ...

15:47 technomancy: angerman: check out the clojure-project function in http://technomancy.us/126#projects

15:49 angerman: technomancy: so I bacaislly unpack the .jars into the dependency folder

15:49 technomancy: right; then the clojure-project function will set up slime's classpath for you

15:50 angerman: technomancy: couldn't it just use the jars?

15:54 technomancy: I hope my questions don't bug you too much

15:55 Raynes: We all enjoy annoying questions. Annoying questions are typically trivial ones, and therefore easy to answer.

15:57 ataggart: the eclipse plugin serves me well. Rainbow parens ftw.

15:58 * angerman is sad about the speed that github has right now (the web interface)

15:59 * Raynes just wishes it had auto-indentation.

16:15 technomancy: angerman: you can use the jars, but I've found unpacking them has its advantages

16:15 angerman: technomancy: tell me about them :)

16:16 technomancy: well mostly that you can add deps at runtime without restarting the JVM

16:16 angerman: ohh and how would I define JNI bindings? -Djava.library.path

16:16 technomancy: also, your classpath can be the same for every project you work on, which is less confusing

16:16 I... don't know what JNI is.

16:16 questions are fine as long as you're OK with a slow response. =)

16:17 angerman: well for example if I want to use Tokyo Cabinet. I need to have some native code libary

16:17 so that's why I need to define a -Djava.librar.path=...

16:17 technomancy: oh, if you just want to set a command-line flag, you can add it to the swank-clojure-extra-vm-args list

16:18 angerman: technomancy: so basically I add all the jars into the dep folder and run clojure-project ? and the swank-clojure-jar-path does automatically list them all up?

16:19 technomancy: angerman: I think you can do that, but I haven't used that myself

16:19 angerman: technomancy: could we have a clojure-create-project fun too? that sets up the project folders?

16:20 technomancy: sure; that's not a bad idea.

16:21 * angerman wonders how one could create a clojure-projcet function that would be able to rely on a config file inside the project file to figure out the structure

16:22 technomancy: angerman: you can use a .dir-locals.el file for project-wide elisp variables if you're using 23

16:22 angerman: as the project structure might be different, e.g. for a deployment

16:22 technomancy: hmm. well src target/classes and test are hardcoded in clojure-project or am I mistaken?

16:23 technomancy: angerman: that's right. but clojure-project is just my own personal helper function, it's not part of clojure-mode or anything

16:23 angerman: technomancy: yes. but why not turn it into one :)

16:24 technomancy: I should.

16:25 I've been using target/ because that's what corkscrew uses (mvn under the covers).

16:25 but it doesn't seem to be a common convention

16:26 * technomancy wonders if he could get swank-clojure accepted into mainline slime

16:26 technomancy: probably not, it's an awful lot of impl-specific code

16:28 angerman: hmm...

16:28 can I somehow attach SLIME to an already running process somehow?

16:28 * angerman wonders how to hook into GAE

16:29 technomancy: angerman: it's doable, but I haven't done it myself.

16:37 angerman: technomancy: so to get the REPL i need to use swank.loader?

16:37 at least, that's the way I understand it :/

16:38 drewr: angerman: currently only via emacs

16:38 at least I haven't success embedding swank

16:38 haven't had

16:38 technomancy: others have done it

16:39 angerman: ok, but it works like this: run swank in clojure to open a port and then connect to that with slime?

16:39 technomancy: I asked them to post to the list about it, but haven't heard back yet.

16:39 drewr: angerman: yes

16:39 angerman: ok, that could get messy with GAE as the environment permits to open a socket .

16:41 Chouser: (some #(when-not (second %) (first %)) (partition 2 1 (map deref (map deref (map #(send-off (agent (promise)) deliver %) (iterate inc 0))))))

16:41 I don't think that should ever return. But for me it does.

16:44 (some (fn [[a b]] (when-not a b)) (partition 2 1 (map (fn [x] @@(send-off (agent (promise)) deliver x)) (iterate inc 0))))

16:44 hiredman: github is sloooooow today

16:44 Chouser: same thing, just simplified the expression.

16:44 what number does that return for you, or does it spin forever (as I think it should)?

16:46 hiredman: jokes on you, my local clojure install is so old the result is java.lang.Exception: Unable to resolve symbol: promise in this context (NO_SOURCE_FILE:1)

16:46 Chouser: :-)

16:49 ah, I think I see it.

16:49 rhickey: 1

16:49 Chouser: (.await d) may unblock before (reset! v x)

16:52 reversing the order of (reset! v x) and (.countDown d) seems to solve it

16:53 at least, my test runs into the 10000s instead of always failing < 6000

16:54 rhickey: you want the whole ticket/patch dance for that?

16:54 rhickey: nope

16:54 angerman: hmm I can't compile clojure-contrib it's missing clojure/walk :/

16:54 Chouser: rhickey: cool

16:55 rhickey: glad someone's trying some of this stuff

16:55 :)

16:55 Chouser: that's no made up test, either.

16:55 Chousuke: angerman: contrib master depends on git clojure at the moment. there's a branch that is still compatible with 1.0.0 though.

16:55 rhickey: Chouser: all the better

16:56 Chouser: well, wheat I posted was, but I was seeing nil's in impossible places in code we're actually using

16:56 angerman: Chousuke: hmm I think i took both git repos

16:56 Chouser: what

16:56 * rhickey would love feedback on ensure branch, chunks, par, etc

16:57 Chousuke: angerman: hmm. from the right source? :P

16:57 hiredman: whoops

16:57 angerman: Chousuke: the ones that clojure-install pulled

16:58 technomancy: angerman: I'll update clojure-install to mention the 1.0-compatible branch too

16:58 it didn't exist when I wrote the last-known-good stuff

16:58 angerman: The way I understood Chousuke would be that if i take both from git it should still work

16:59 technomancy: angerman: yes, but clojure-install uses clojure 1.0.0 by default

16:59 Chouser: I'm just not doing anything that would push ensure or take advantage of par.

16:59 Chousuke: angerman: well, clojure-install may checkout some branch other than master

16:59 technomancy: angerman: you can run "git checkout master" in the clojure dir if you'd rather stay with the cutting-edge

16:59 maybe I could make it an option in clojure-install

17:00 * angerman fails to see where clojure-install pulls the 1.0.0 branch

17:00 angerman: hmm.

17:02 technomancy: angerman: it's in the "last-known-good" section

17:03 angerman: yes, but that's what I commented out because it broke with the CDPATH thing.

17:04 ok, the checkout when through somehow

17:17 blbrown_win: in terms of clojure performance, aren't most functions and use of clojure really just calls on top of the JVM. So, for most code we should see comparable performance with Java code. ...is that safe to say?

17:20 Chousuke: well, java code that uses function objects, lazy seqs and immutable collections, yes :)

17:22 blbrown_win: So it really depends on the approach you use with Clojure. There isn't going to be a one to one, Clojure code runs as fast as Java code (say if they end up at the same outcome)

17:23 Chousuke, that was directed at you

17:23 Chousuke: hmm.

17:23 well, you can write loops that compile down to the same bytecode as a java loop

17:24 blbrown_win: Chouser, sounds like the response is that "it depends"

17:24 Chousuke: but most clojure code tends to be rather different from idiomatic java code.

17:24 with higher-order functions and all.

17:25 Chouser: Chousuke: I wonder how often I get unspoken credit for things you say...

17:25 Chousuke: Chouser: heh :P

17:25 blbrown_win: I thought you guys were the same for a second

17:25 Chouser: Chousuke: how'd you end up with that nick anyway. Your g.group name is nice and unique...

17:26 blbrown_win: Like they always say, "don't guess, measure". I was writing some performance test code. Of course, my tests will get a lot of flack...performance tests always do

17:26 Chousuke: Chouser: I was given this nickname :P

17:27 blbrown_win: heh.

17:27 stuartsierra: Just remember to use *warn-on-reflection* true, that makes a huge difference.

17:27 Chousuke: blbrown_win: rhickey posted some interesting microbenchmarks from his "par" branch yesterday :)

17:28 blbrown_win: stuartsierra, Yea I see that a lot. Most of my code will not use Java oriented code though.

17:28 Chousuke: blbrown_win: http://paste.lisp.org/display/84027

17:29 blbrown_win: is clojure.par ...parallel?

17:29 Chousuke: of course, it's only that much faster because it utilises four cores instead of one, but...

17:29 yeah.

17:29 blbrown_win: isn't that jvm specific stuff

17:30 Chousuke: well, the library uses forkjoin apparently, which is something that will appear in JDK7

17:31 Chouser: I think it's running into trouble in that process.

17:31 blbrown_win: yea, that is what I am kind of saying. Some clojure code is kind of a wrapper on top of JVM functionality.

17:31 Chousuke: blbrown_win: the parallel vector stuff isn't though.

17:31 blbrown_win: it works with clojure vectors.

17:31 blbrown_win: ah

17:32 Chousuke: I don't seem to get much improvement from clojure.par though :/

17:33 it does help a bit, and is indeed faster than the (mutable!) arraylist, but I suspect my RAM might be a bottleneck

17:35 rhickey: Chouser: where did you see/hear that?

17:35 Chouser: rhickey: I thought you said that.

17:35 Chousuke: And then I get really inconsistent results if I enable escape analysis: anywhere from 50ms to 1200ms for the last parallel vector operation. :P

17:36 Chouser: ah, maybe ParallelArray is the only casualty so far?

17:37 rhickey: Chouser: right, afaik, the division into jsr166y and extra166y reflects what's in/out of JDK 7

17:37 angerman: rhickey: did you get a sore throught thoughout the clojure presentations?

17:38 rhickey: angerman: which presentations?

17:38 angerman: Clojure for Java.

17:39 rhickey: just wondering. Because you really talk a lot.

17:39 rhickey: I see

17:41 * angerman only did tutor lectures for mech eng. but those were at max 90min.

17:43 blbrown_win: angerman, are you in industry now?

17:44 angerman: blbrown_win: I'm in my final year doing my (German Diplom) in Mathematics at Technical University of Munich

17:44 blbrown_win: nice

17:45 angerman: instead of studing I'm once again exploring a new language [...] :)

17:45 kotarak: sounds familiar ;)

17:46 angerman: if only clojure would be dead fast for linear algebra, I could try some of my classification algorithms ...

17:46 * kotarak has a Diplom in Mathematics of the University of Kaiserslautern

17:46 angerman: kotarak: since when? ;)

17:46 kotarak: 5 years

17:47 Chouser: JNI's still kicking me around.

17:47 angerman: well that's close to when I started.

17:47 Chouser: I had my share with Tokyo Cabinet ... never had so much trouble compiling any source :/

17:48 Chouser: everything appears to compile, and the .so loads. but I still can call into the native code.

17:49 angerman: Chouser: ohh. Well TC had it's java bindings already, but compiling the JNI libs against TC was really messy. Especially figuring out that I needed x86_64 binaries and the configure didn't figure that out :/

17:49 * angerman goes to look into some database interfaces for clojure.

17:50 angerman: appengine-clj does have a datastore layer but that one is somewhat verbose and not really "nice"

17:50 kotarak: angerman: would have been the first configure script which figured something out... :/

17:51 angerman: kotarak: yea. this whole autoconf stuff keeps on being the biggest mess ever

18:03 good night everyone. The Clojure for Lisp Programmers and Clojure for Java Programmers presentations are quite good :)

18:11 Chouser: aaaaaaaaaaa!!!!!!!

18:12 hiredman: someone kick your football?

18:12 Chouser: had an old .so under an old name. That's the one I was loading and testing.

18:12 had a new .so under a new name. That's one I was changing and compiling. :-(

18:13 Chousuke: :|

18:14 Chouser: ok. sheesh. well, now it works from java but not clojure.

18:19 dinnertime...

18:19 stuartsierra: later dudes

19:19 blbrown_win: with clojure contrib how do you use the group-by function

19:19 (group-by 3 (1 2 3))

19:19 '(group-by 3 (1 2 3))

19:19 hiredman: ,(doc group-by)

19:19 clojurebot: "([f coll]); Returns a sorted map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the corresponding elements, in the order they appeared in coll."

19:20 blbrown_win: I see the doc,

19:20 oh

19:20 hiredman: you most likely want partition

19:20 or partition-by

19:20 blbrown_win: ,(group-by (fn [x] true) (1 2 3 ))

19:20 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn

19:24 blbrown_win: ,(group-by (comp #(.toString %) class) [1 2 "three" :four])

19:24 clojurebot: {"class clojure.lang.Keyword" [:four], "class java.lang.Integer" [1 2], "class java.lang.String" ["three"]}

19:28 blbrown_win: interesting

19:30 Raynes: I wish Factor had GTK bindings. :\

19:36 blbrown_win: you can write them. the FFI is pretty easy

19:37 Raynes: blbrown_win: I don't wanna. :p

19:37 blbrown_win: Raynes are you a factor guy (user). I was thinking of writing benchmarks and comparing the factor benchmarks to clojure hhmm

19:42 ,(loop [a () i 1e2] (if (= i 0) a (recur (conj a "a") (- i 1))))

19:42 clojurebot: ("a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "a")

19:45 Raynes: blbrown_win: I'm kind of new to Factor. I'm not really a /Factor/ guy.

19:45 blbrown_win: I wrote the mysql driver, hehe long time agop

19:55 technomancy: has anyone encountered the geostd8 encoding before?

19:56 fsm: A cleaned-up version of my raytracer: http://tu.be/graphics/tracer.zip

19:56 Fixed bug in depth-of-field calculations

19:57 technomancy: not finding any way of handing that in Java

19:57 it's pretty obscure

19:57 beutdeuce: is apply similar to haskell's map or fold?

20:03 mebaran151: georgian encoding?

20:04 technomancy: mebaran151: yeah

20:04 mebaran151: that is a bit obscure....

20:08 looks like it's a standard 8 bit encoding: what do you have to do with it?

20:16 technomancy: mebaran151: reading it without an exception would be a good start. =)

20:18 beutdeuce: whats wrong with this => http://gist.github.com/153755

20:20 actually this =. http://pastie.org/557150

20:28 fsm: I posted some sample images: http://tu.be/graphics/

20:29 technomancy: fsm: looks nice!

20:29 fsm: Thanks

20:29 blbrown_win: ,(doc immigrate)

20:29 clojurebot: "/;nil; "

21:54 rabidsnail: hello all

21:56 JAS415: i have a question about classpath

21:56 Raynes: Shoot.

21:56 JAS415: i have my bash script setup like so: java -cp $CLOJURE_DIR/jline-0.9.94.jar:$CLOJURE_JAR:$CONTRIB_JAR \

21:56 jline.ConsoleRunner clojure.lang.Repl

21:56 with the environment variables set to the various paths

21:57 yet when i execute the script and do (for example) (in-ns clojure.contrib.math)

21:57 i get "ClassNotFoundException: clojure.contrib.math"

21:58 arohner: quote it

21:58 (in-ns 'clojure.contrib.math)

21:58 JAS415: ahhh

21:58 thanks :-)

21:59 arohner: np. without the quote, clojure tries to get the value of the symbol clojure.contrib.math

22:00 i.e. (let [x (symbol "clojure.contrib.math")] (in-ns x))

22:01 rabidsnail: What's the proper way to do an sequence slice?

22:04 JAS415: i'm still not sure i've got this right with the loading of the contrib though

22:04 arohner: rabidsnail: what do you mean?

22:04 JAS415: shouldn't all of the contrib ns be loaded?

22:04 rabidsnail: The equivalent of my_array[5:10] in Python.

22:04 JAS415: so when i do (all-ns) from use it would return them?

22:05 rabidsnail: Take a range of elements from a sequence between two indices.

22:05 arohner: JAS415: no, the individual contrib ns's will be loaded after calls to require

22:05 and there's no require clojure.contrib.*

22:05 JAS415: ah okay

22:06 i'm gonna write this stuff down or else i'll forget

22:07 arohner: rabidsnail: if you have a vector, you can use subvec

22:07 ,(doc subvec)

22:07 clojurebot: "([v start] [v start end]); Returns a persistent vector of the items in vector from start (inclusive) to end (exclusive). If end is not supplied, defaults to (count vector). This operation is O(1) and very fast, as the resulting vector shares structure with the original and no trimming is done."

22:07 arohner: if you have something else, i.e. a list or a map, I think you'll have to use drop and take

Logging service provided by n01se.net