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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en