#clojure log - Jul 14 2008

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

13:11 Chouser: sometimes you just need reduce, because you can't do this with apply:

13:11 (defn sum-of-squares [s] (reduce (fn [a b] (+ a (* b b))) 0 s))

13:11 unless you do it like this:

13:11 (defn sum-of-squares [s] (apply + (map #(* % %) s)))

13:12 ...which is clearer, shorter, and lazy. hmm...

13:12 * Chouser tries for another example.

13:12 abrooks: Heh.

13:15 rhickey: some seqs have an internal reduce, which will be much faster than apply

13:16 Chouser: (reduce (fn [m v] (assoc m v (str v "_val"))) {} '(a b c d))

13:16 (into {} (map #(vector % (str % "_val")) '(a b c d)))

13:16 rhickey: really? that's interesting.

13:18 cemerick: That's *very* interesting.

13:19 Chouser: with new variadic conj: (apply conj {} (map #(vector % (str % "_val")) '(a b c d)))

13:20 cemerick: rhickey: thanks for the quick turnaround on the outstanding topics :-)

13:20 rhickey: yes, since for some data structures there's a perf benefit in not creating a general-purpose seq

13:20 cemerick: sure

13:21 cemerick: I think it's a pretty good sign overall that the worst/best I can come up with are patches handling exit codes and reflection-warning filenames

18:53 rhickey: http://clojure.org/Contributing - any thoughts?

21:55 abrooks: rhickey: "Contributing" looks good. On a semi-related note, is it too early to consider a more formalized enhancement forum similar to Python Enhancement Proposals (PEPs)? This could help focus some of the questions., suggestions and effort. Perhaps it's too early but those sorts of things are often added too late.

21:55 * abrooks pretends not to be suggesting work that he doesn't have time to do...

22:12 rhickey: abrooks: I'm sure we can add more formality later, but I'm interesting in seeing what develops naturally before adopting an existing system (not that there's anything wrong with PEPs)

22:13 abrooks: That sounds good.

22:18 albino: PEPs mostly developed out of guido getting tired of saying "already rejected", he could just reference PEPs after that

Logging service provided by n01se.net