#clojure log - May 30 2009

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

0:02 cp2: "Garbage First, or G1, is a low pause, server style collector. G1's primary advantages over the Concurrent Mark-Sweep (CMS) collector include incremental compaction, better predictability and ease of use.

0:02 Although G1 is available for use in this release, note that production use of G1 is only permitted where a Java support contract has been purchased. G1 is supported thru Sun's Java Platform Standard Edition for Business program.

0:02 ahhh oracle...

0:11 hiredman: cp2: I hearing that they said that just because it is alpha and they are covering their backside

0:53 clojurebot: science?

0:53 clojurebot: make a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive

0:54 hiredman: clojurebot: science is <reply>"science is whatever we want it to be" -- Dr. Spaceman

0:54 clojurebot: Alles klar

0:59 durka42: oh dear

0:59 writing about code is a really good way to find bugs, isn't it

0:59 * durka42 find bugs upon bugs hiding other bugs

0:59 durka42: finding*

1:00 if i fix this bug correctly nothing will change, because there are multiple coincidences hiding it

1:22 i'm being asked whether clojure is more similar to CL or scheme

1:22 what do y'all think

1:23 * durka42 is not really qualified to answer

1:33 duck1123: durka42: I'm not either, but if I had to guess, I'd say scheme

1:34 durka42: that was my answer

1:34 because, i said, of functional tendencies and lack of cruft

1:35 duck1123: so does anyone know if clojurescript is fit to write my jquery code yet

1:35 cause I'm much rather be writing clojure right now than js

1:35 durka42: wouldn't that require porting jquery to clojurescript?

1:35 or is there an FFI

1:35 rich_holygoat: durka42: conversely, it has a usably large standard library, multimethods are similar to CL generics, and the specifics of the syntax (e.g., defn) remind me more of CL.

1:36 durka42: good points

1:36 i don't know what scheme does for generics

1:37 duck1123: I assumed that clojurescript was able to interface with pure javascript functions

6:02 dejj: How do I turn a StructMap into a dissociatable map?

6:21 leafw: dejj: add all its values to a new non-struct map.

6:26 hoeck: /quit bye

6:46 dejj: @leafw: is there some brief way to do that?

7:05 cgrand: dejj: (conj {} your-struct)

7:07 dejj: ah, thank you

12:58 * durka42 is finally writing entries in the blog that Chouser encouraged me to start

13:01 gnuvince_: durka42: Url?

13:02 * durka42 git push origin master

13:02 durka42: one second

13:04 i guess i should upload the pictures as well...

13:05 that's better

13:05 http://durka.github.com/2009/05/28/subleq-assembler.html

13:07 rsynnott: github does blogs now?

13:07 also, have you an RSS feed?

13:07 no use having a blog without an RSS feed

13:07 durka42: rsynnott: working on that :)

13:07 i was going to just use the template engine the github provides to generate one

13:08 rsynnott: http://github.com/blog/272-github-pages

13:08 * rsynnott just took the easy way out and used blogger :)

13:20 durka42: oh, excellent

13:20 the guy who invented github pages has an auto-generating atom.xml that i can steal

13:27 rsynnott: does the RSS feed work now?

14:43 achin: Does anyone have any editor/IDE recommendations other than Emacs/SLIME?

15:00 hoeck: achin: netbeans with enclojure plugin

15:00 achin: Is that what you use?

15:00 hoeck: achin: I'm an emacs/slime user, but i tried it once at my windows workstation at work

15:00 achin: I'm playing with the TextMate bundle now, but it's buggy.

15:00 Hmm.

15:01 hoeck: achin: and besides beeing not emacs, i really liked it

15:01 clojurebot: emacs is best configured for Clojure with instructions at http://technomancy.us/126

15:01 achin: hoeck: Thanks.

15:01 hoeck: especially the easy integration of non-clojure libraries and java-code

15:01 achin: I'll give it a shot.

15:36 unlink: What's a better way of doing (when-let [a (func)] (when-let [b (func2 a)] (when-let [c (func3 b)] ...))) ?

15:41 hiredman: I think there is -?> in contrib

15:41 somewhere

15:41 ~def -?>

15:46 unlink1: hiredman: that is for dotting

15:47 java stuff

15:47 I basically want nilsafe-comp

15:52 hiredman: uh

15:52 durka42: unlink1: .?. is for java. -?> is like ->

15:53 hiredman: (-?> (func) func2 func3)

15:57 unlink1: right

15:57 that's sort of similar, but only threads the 2nd arg

15:57 ,((fn [[name]] (-?> (symbol name) resolve)) ["java.lang.String"])

15:57 clojurebot: java.lang.Exception: Unable to resolve symbol: -?> in this context

15:57 unlink1: ,(use 'clojure.contrib.core) ((fn [[name]] (-?> (symbol name) resolve)) ["java.lang.String"])

15:57 clojurebot: nil

15:58 unlink1: (resolve 'java.lang.String)

15:58 er.

15:58 ,(resolve 'java.lang.String)

15:58 clojurebot: java.lang.String

15:58 hiredman: ,(-?> (symbol "java.lang.String") resolve)

15:58 clojurebot: java.lang.String

15:59 hiredman: ,(-?> (symbol "java.lang.Foo") resolve)

15:59 clojurebot: java.lang.ClassNotFoundException: java.lang.Foo

15:59 hiredman: ,(resolve 'java.lang.Foo)

16:00 clojurebot: java.lang.ClassNotFoundException: java.lang.Foo

16:01 durka42: ,(-?> (symbol "java.lang.String") resolve newInstance)

16:01 clojurebot: java.lang.Exception: Unable to resolve symbol: newInstance in this context

16:01 durka42: ,(-?> (symbol "java.lang.String") resolve .newInstance)

16:01 clojurebot: ""

16:04 durka42: ,(-> (symbol "java.lang.String") resolve .newInstance seq getClass)

16:04 clojurebot: java.lang.Exception: Unable to resolve symbol: getClass in this context

16:04 durka42: ,(-> (symbol "java.lang.String") resolve .newInstance seq .getClass)

16:04 clojurebot: java.lang.NullPointerException

16:04 durka42: ,(-?> (symbol "java.lang.String") resolve .newInstance seq .getClass)

16:04 clojurebot: nil

16:10 achin: How do I make a new type of seq? i.e. implement ISeq?

16:15 hiredman: easiest is to just make a function that explicitly creates a seq from something

16:15 like iterator-seq

16:16 quidnunc: How do I implement a selector for text in enlive? I have tried using text-node and (text-pred text-node) as selectors but they don't seem to match anything.

16:57 bradford: anyone know of a clojrue lib around hadoop?

16:57 i'm trying to get setup with amazon elastic map reduce and do my mapper sand reducers in clojure

16:58 i saw something from Bendiken but it seems to be donw now

17:43 Chouser: /nick Chouser_

17:44 ah, well...

17:44 danlarkin: too many chousers!

17:56 j-dot: is there any reliable way to get a reference to a function from a string containing the name of the function? Something in the spirit of the following paste ...

17:57 lisppaste8: j-dot pasted "Getting a function from a string" at http://paste.lisp.org/display/81089

17:57 hiredman: ,(resolve (symbol "+"))

17:57 clojurebot: #'clojure.core/+

17:57 hiredman: ,((resolve (symbol "+")) 1 2)

17:57 clojurebot: 3

17:57 j-dot: ahh, thank you!

17:57 I knew it was there somewhere

17:58 hiredman: that is actually the var, but vars dispatch function calls to their contents

17:58 Chouser: be aware that resolves in a globall context. Using your macro inside a fn and giving it the name of a local won't work.

17:59 j-dot: thanks, Chouser ... I'm only interested in resolving a few fns from clojure.core for now

20:11 bradford: ,(#({:a %}) 10)

20:11 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: PersistentArrayMap

20:12 bradford: how do i do something liek that?

20:13 ,((fn [b] {:a b}) 10)

20:13 clojurebot: {:a 10}

20:14 bradford: hmmm - what is it about the # version of hte lambda that doesn't work for building the literal map in this case?

20:46 Chouser: the #() includes the inner parens

20:46 #({:a %}) is like (fn [x] ({:a %}))

20:50 quidnunc: Anyone know how the text-node selector is used in enlive?

20:55 Roland_LW: hi

20:56 rhickey: hi

20:56 Roland_LW: What is the best web framework for clojure?

20:56 slashus2: ,(#(map :a %) 10)

20:56 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Integer

20:57 rhickey: ,(#(hash-map :a %) 10)

20:57 clojurebot: {:a 10}

20:58 slashus2: oops

20:58 quidnunc: Roland_LW: Is there something besides compojure?

20:58 rhickey: Roland_LW: compojure seems to have the most activity: http://groups.google.com/group/compojure

20:58 Roland_LW: I don't know even compojure, I'm new to this

20:58 slashus2: I completely lost my mind there.

20:59 rhickey: slashus2: no worries, map is heavily overloaded

20:59 quidnunc: Best is easy to evaluate when there is a single contender.

20:59 Roland_LW: Is compojure ready for production use? I'm planning to do a serious project and we are choosing between Ruby and Cojure

21:00 Clojure

21:07 anyone? ;)

21:07 Anyone ever faced the decision Ruby(on Rails) vs. Clojure?

21:08 rhickey: Roland_LW: you might want to join the Compojure group and ask there - more likely to get Compojure users than are here right now

21:10 Roland_LW: rhickey: yeah, you have a good point there. :)

21:11 quidnunc: Roland_LW: I can't imagine that Compojure is more mature than Rails.

21:11 Roland_LW: quidnunc: sure, but more mature doesn't mean that Rails is better. Also, we are planning for the future here

21:11 quidnunc: or is near the maturity of Rails. Not that that is praise for ruby

21:12 slashus2: Does compojure have a website yet?

21:14 Roland_LW: slashus2 compojure.org is not up yet

21:37 spooon: I understand why seqs need the new rest method in order to be fully lazy, but why keep next around on the ISeq interface?

21:38 Can't next be implemented in terms of rest?

22:34 arkady: been trying some basic socket IO, is there a class like BufferedReader which doesn't block on readLine if no data is available?

22:36 slashus2: arkady: Have you looked at java.nio ? I think that stuff is for non-blocking IO. I don't know if that is what you are looking for.

22:38 arkady: slashus2: seen that, looks like overkill

22:39 slashus2: shouldn't bufferedreader return 'nil' if it doesn't have a proper line?

22:39 Chouser: wouldn't you have to poll it then? :-/

22:39 Clojure works nicely with threads -- you don't want a separate thread blocking on the socket?

22:40 arkady: yeah, that will probably work

22:41 does clojure have a special thread construct, or do I have to use the Thread class manually?

22:44 documentation is really rather scant

22:46 Chouser: for?

22:46 everything? :-)

22:47 slashus2: arkady: It is easy to create a thread because clojure functions implement runnable.

22:47 ,(.start (Thread. (fn [] (println "hello"))))

22:47 clojurebot: nil

22:47 arkady: ah, right

22:48 thanks. just figured there was some "proc" syntax or something

22:51 slashus2: ,(.get (future (println "hello")))

22:51 clojurebot: nil

22:58 Chouser: prinln returns nil, even in the future.

22:58 println

22:59 slashus2: 1000 years in the future.

Logging service provided by n01se.net