Re: Memfn: what does it mean?

2009-08-04 Thread Meikel Brandmeyer
Hi, On Aug 3, 10:10 pm, John Harrop jharrop...@gmail.com wrote: (defn and-ns   A non-short-circuiting \and\ usable in reduce etc.   ([] true)   ([a] a)   ([a b] (and a b))   ([a b more] (reduce and-ns (and a b) more))) Don't think to complicated. (reduce #(and %1 %2) coll)

Re: Memfn: what does it mean?

2009-08-04 Thread John Harrop
On Tue, Aug 4, 2009 at 2:22 AM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Aug 3, 10:10 pm, John Harrop jharrop...@gmail.com wrote: (defn and-ns A non-short-circuiting \and\ usable in reduce etc. ([] true) ([a] a) ([a b] (and a b)) ([a b more] (reduce and-ns (and a

Re: Memfn: what does it mean?

2009-08-04 Thread Rich Hickey
On Tue, Aug 4, 2009 at 2:22 AM, Meikel Brandmeyerm...@kotka.de wrote: Hi, On Aug 3, 10:10 pm, John Harrop jharrop...@gmail.com wrote: (defn and-ns   A non-short-circuiting \and\ usable in reduce etc.   ([] true)   ([a] a)   ([a b] (and a b))   ([a b more] (reduce and-ns (and a b)

Memfn: what does it mean?

2009-08-03 Thread Garth Sheldon-Coulson
Out of curiosity, does anyone know what memfn stands for? Is it an abbreviation? Fn obviously stands for function. Mem calls to mind memoize, but I'm not sure I see how memfn memoizes anything... --~--~-~--~~~---~--~~ You received this message because you are

Re: Memfn: what does it mean?

2009-08-03 Thread Mike DeLaurentis
I believe it stands for member function. From the doc string: Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn. On Mon,

Re: Memfn: what does it mean?

2009-08-03 Thread Garth Sheldon-Coulson
Ah, makes sense. Thanks. On Mon, Aug 3, 2009 at 8:53 AM, Mike DeLaurentis delauren...@gmail.comwrote: I believe it stands for member function. From the doc string: Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on

Re: Memfn: what does it mean?

2009-08-03 Thread John Harrop
On Mon, Aug 3, 2009 at 8:53 AM, Mike DeLaurentis delauren...@gmail.comwrote: I believe it stands for member function. From the doc string: Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the

Re: Memfn: what does it mean?

2009-08-03 Thread Richard Newman
user= (macroexpand-1 '(memfn add x y)) (clojure.core/fn [target__4193__auto__ x y] (. target__4193__auto__ (add x y))) That is, basically (fn [object x y] (.add object x y)). .add is macroexpanded into the more general dot form, as shown in the memfn expansion. user= (read-string (.foo

Re: Memfn: what does it mean?

2009-08-03 Thread John Harrop
On Mon, Aug 3, 2009 at 3:45 PM, Richard Newman holyg...@gmail.com wrote: user= (macroexpand-1 '(memfn add x y)) (clojure.core/fn [target__4193__auto__ x y] (. target__4193__auto__ (add x y))) That is, basically (fn [object x y] (.add object x y)). .add is macroexpanded into the more