Re: Attractive examples of function-generating functions

2012-08-16 Thread Roberto Mannai
typo, I meant ring *middleware*, not ring handlers On Thu, Aug 16, 2012 at 1:01 PM, Roberto Mannai wrote: > > So if you are searching for practical examples I'd suggest to look for > such use cases, although their best application IMHO has to be found not in > business code but in utility librar

Re: Attractive examples of function-generating functions

2012-08-16 Thread Roberto Mannai
I don't have my own examples, anyway being a daily object-oriented programmer I'm feeling compelled to say that where "function-generating functions" prove their main practical power is in what I'd label "man in the middle functions". Whenever I need to add behaviour to an existing OO method I hav

Re: Attractive examples of function-generating functions

2012-08-12 Thread Malcolm Sparks
> 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. >>> >>> >>> Brian, when I saw this I was reminded of ring middleware - eg. http://jgre.org/2010/10/04/ring-middleware/ -- You received

Re: Attractive examples of function-generating functions

2012-08-10 Thread Brian Rowe
That's a good call. +1 On Friday, August 10, 2012 8:36:25 AM UTC-4, Jonas 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 > > O

Re: Attractive examples of function-generating functions

2012-08-10 Thread Maik Schünemann
I think enlives transformersare a very good example of functions returning functions. Maybe you should have a look at the getting started guide and the tutorials Send from Android Am 09.08.2012 23:13 schrieb "Jonah Benton" : > You've probably seen these, but if not, Doug Crockford's video series >

Re: Attractive examples of function-generating functions

2012-08-10 Thread Alex Baranosky
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 wrote: > How about the new reducers library: > > > http://c

Re: Attractive examples of function-generating functions

2012-08-10 Thread Jonas
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

Re: Attractive examples of function-generating functions

2012-08-09 Thread Jonah Benton
You've probably seen these, but if not, Doug Crockford's video series on javascript walks through a number of interesting information sharing examples like the ones you're looking for using fn-generating-fns- http://yuiblog.com/crockford/ They're all great but "act 3 - function the ultimate" is e

Re: Attractive examples of function-generating functions

2012-08-09 Thread hyPiRion
On Wednesday, August 8, 2012 6:48:23 PM UTC+2, Brian Marick wrote: > > ... 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 > gen

Re: Attractive examples of function-generating functions

2012-08-09 Thread Chris Ford
I use quite a few of these in my Overtone rendering of Bach : ; Defining a scale function from intervals (defn sum-n [series n] (reduce + (take n series))) (defn scale [intervals] (fn [degree] (if-not (neg? degree) (sum-n (

Re: Attractive examples of function-generating functions

2012-08-08 Thread Ben Mabey
On 8/8/12 10:48 AM, 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]))

Re: Attractive examples of function-generating functions

2012-08-08 Thread Robert Marianski
On Wed, Aug 08, 2012 at 08:00:26PM -0600, Jim Weirich wrote: > > On Aug 8, 2012, at 1:50 PM, Timothy Baldridge wrote: > > > > > >>I'm looking for medium-scale examples of using function-generating > > >>functions. > > > > > > I'm not sure if this is exactly what you're looking for, but this

Re: Attractive examples of function-generating functions

2012-08-08 Thread Brian Rowe
Maybe SICP's simulator of digital circuits will provide some inspiration. I know when I read this I was deeply awed by what HOFs can do. Maybe Clojure's zippers would be good too? On Wednesday, August 8, 2012 12:48:23 PM UTC-4, Brian Marick wrote: > > I'm looking for medium-scale examples of usi

Re: Attractive examples of function-generating functions

2012-08-08 Thread Jim Weirich
On Aug 8, 2012, at 1:50 PM, Timothy Baldridge wrote: > > >>I'm looking for medium-scale examples of using function-generating > >>functions. > > > I'm not sure if this is exactly what you're looking for, but this sort of > thing is pretty cool: > > (defn make-point [x y] > (fn [member]

Re: Attractive examples of function-generating functions

2012-08-08 Thread Brian Marick
On Aug 8, 2012, at 2:50 PM, Timothy Baldridge wrote: > I'm not sure if this is exactly what you're looking for, but this sort of > thing is pretty cool: > > (defn make-point [x y] > (fn [member] > (cond (= member :x) x > (= member :y) y))) > I actually have a whole chapter

Re: Attractive examples of function-generating functions

2012-08-08 Thread Nelson Morris
On Wed, Aug 8, 2012 at 11:48 AM, Brian Marick wrote: > I'm looking for medium-scale examples of using function-generating functions. > > Such examples might be ones that ... use closures to avoid the need to have > some particular argument passed from function to function (which looks like > the

Re: Attractive examples of function-generating functions

2012-08-08 Thread nicolas.o...@gmail.com
trampolines is a slightly different example. -- 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 uns

Re: Attractive examples of function-generating functions

2012-08-08 Thread Timothy Baldridge
>>I'm looking for medium-scale examples of using function-generating functions. I'm not sure if this is exactly what you're looking for, but this sort of thing is pretty cool: (defn make-point [x y] (fn [member] (cond (= member :x) x (= member :y) y))) We're basically creatin

Attractive examples of function-generating functions

2012-08-08 Thread Brian Marick
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 fo