While admittedly neat, and educational, this kind of code is fancy for
production use in my opinion:

(defn make-point [x y]
  (fn [member]
    (cond (= member :x) x
             (= member :y) y)))

On Fri, Aug 10, 2012 at 6:06 PM, Jonas <jonas.enl...@gmail.com> wrote:

> How about the new reducers library:
>
>
> http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
> http://clojure.com/blog/2012/05/15/anatomy-of-reducer.html
>
> Jonas
>
> On Wednesday, August 8, 2012 7:48:23 PM UTC+3, Brian Marick wrote:
>>
>> I'm looking for medium-scale examples of using function-generating
>> functions. I'm doing it because examples like this:
>>
>> (def make-incrementer
>>      (fn [increment]
>>        (fn [x] (+ increment x))))
>>
>> ... or this:
>>
>> (def incish (partial map + [100 200 300]))
>>
>> ... show the mechanics, but I'm looking for examples that would resonate
>> more with an object-oriented programmer. Such examples might be ones that
>> close over a number of values (which looks more like an object), or
>> generate multiple functions that all close over a shared value (which looks
>> more like an object), or use closures to avoid the need to have some
>> particular argument passed from function to function (which looks like the
>> `this` in an instance method).
>>
>> Note: please put the flamethrower down. I'm not saying that "looking like
>> objects" is the point of higher-order functions.
>>
>> I'll give full credit.
>>
>> -----
>> Brian Marick, Artisanal Labrador
>> Contract programming in Ruby and Clojure
>> Occasional consulting on Agile
>>
>>
>>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to