Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread mago
I don't know anything about how a bird navigates as part of a flock, but I guess it uses its eyes to see the other birds. And I also imagine that it pays more attention to birds nearby than to far away birds. Maybe it even uses the area covered on its retina by the other bird to assign to assign i

Re: Functional programming newbie question

2008-12-12 Thread mago
I guess one answer to your question would be: If the seq is persistent (immutable) why would you need to make a copy of it? On Dec 12, 8:51 pm, levand wrote: > So, I'm trying to understand functional programming, particularly as > it relates to the seq abstraction, and I'm hitting a slight diffi

Re: frequency of each unique item in collection

2008-12-11 Thread mago
Slightly shorter version: (defn frequencies "Returns a map from distinct items in coll to the number of times they appear." [coll] (reduce (fn [counts x] (merge-with + counts {x 1})) {} coll)) On Dec 11, 9:14 am, Stuart Sierra wr