#clojure log - May 24 2008

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

10:03 asbjxrn: Is there a more idiomatic version of (concat foo (list 5)) ?

10:04 rhickey: what is foo?

10:04 asbjxrn: a list.

10:04 rhickey: (concat foo [5])

10:05 but if you find it consistently needs to grow at the end, perhaps a vector is a better choice for foo

10:06 asbjxrn: It's actually something like (fn [foo] (call-something-else-with-an-additional-parameter (concat foo [5]))

10:11 ref-set and alter fulfill pretty much the same functionality(?) Any guidelines for when to use either one?

10:11 Uh.

10:11 rhickey: alter

10:11 is preferred if the new state is in any way a function of the old

10:12 asbjxrn: Ok, I need some refactoring tool :) I've got ref-set all over, and all I do is reset one element in a map...

10:15 Looks nicer as well. Shorter at least.

10:16 rhickey: clearer too

10:19 asbjxrn: That I'm not sure about. I find ref-set pretty clear. The way alter changes the function call by putting the ref as the first argument to the function automatically isn't as clear to me.

10:20 unfamiliar is perhaps a better word for it than unclear.

10:20 rhickey: see how you feel after using it a while

10:20 heh

Logging service provided by n01se.net