Emeka,
In short, no. Remember, this was about me learning some functional
tools, so this shouldn't be viewed as pedagogical. Well, *my* code
shouldn't - I can't speak for the other posters in this thread.
-Matt
On Dec 27, 7:28 am, Emeka emekami...@gmail.com wrote:
(defn sum-up-to [n]
On Dec 24, 4:20 pm, Mibu mibu.cloj...@gmail.com wrote:
I'd write it this way:
(apply + (mapcat #(range 1 %) (range 2 14)))
I think idiomatically I would have written it with (partial range 1)
instead of #(range 1 %), but I prefer compact forms.
In Clojure (anybody correct me if I'm wrong) I
On Mon, Dec 29, 2008 at 9:36 PM, Aaron Brooks aa...@brooks1.net wrote:
In Clojure (anybody correct me if I'm wrong) I think it's preferable
for performance reasons to use reduce instead of apply when you can.
I actually think that's backwards. In many cases it doesn't really
matter. It's
I was presented with the question How many gifts, total, are
mentioned in the song 'The 12 Days of Christmas'? I thought, Aha!
I'll use clojure to figure it out. But I wanted to do it
idiomatically, using some functional constructs (with which I'm not
very familiar). First, I needed to know how
On Dec 24, 2008, at 1:57 PM, MattyDub wrote:
(Originally, I didn't know about the 2-argument version of range,
so I was using map and an anonymous inline function to add 1 to each
result from range, like:
(map #(sum-up-to (inc %)) (range 12))
Then I thought This can't be right, there has to