Re: Function syntax

2015-08-13 Thread Leon Grapenthin
It is a matter of personal style. Note that there is a max function. On Thursday, August 13, 2015 at 1:53:23 PM UTC+2, Herwig Hochleitner wrote: > > Yep, I meant the thing, `vector` is doing. Thanks! > > 2015-08-13 13:36 GMT+02:00 Amith George > > : > >> Maybe you meant to use `vector` instead of

Re: Function syntax

2015-08-13 Thread Herwig Hochleitner
Yep, I meant the thing, `vector` is doing. Thanks! 2015-08-13 13:36 GMT+02:00 Amith George : > Maybe you meant to use `vector` instead of `vec`? `vec` doesn't accept > variable args. Hence my original question. > > On Thursday, 13 August 2015 16:24:43 UTC+5:30, Herwig Hochleitner wrote: >> >> 201

Re: Function syntax

2015-08-13 Thread Amith George
Maybe you meant to use `vector` instead of `vec`? `vec` doesn't accept variable args. Hence my original question. On Thursday, 13 August 2015 16:24:43 UTC+5:30, Herwig Hochleitner wrote: > > 2015-08-13 11:13 GMT+02:00 Amith George > > : > >> >> Could you please explain why is the `vec` needed? F

Re: Function syntax

2015-08-13 Thread Amith George
Hi, I originally interpreted Erik's reply to mean -> Instead of `#(last (sort %&))` do `#((comp last sort) %&)`. This works without any issue. Herwig's suggestion was about replacing the entire anonymous function with `(comp last sort vec)`. The example you gave `((comp last sort) 3 2 1)`, ev

Re: Function syntax

2015-08-13 Thread Herwig Hochleitner
2015-08-13 11:13 GMT+02:00 Amith George : > > Could you please explain why is the `vec` needed? From what I understand, > we are expected to treat the variadic args argument as a seq, nothing more. > > What Tassilo said. Also, it's not nessecary to use `vec`, but you need a function that creates a

Re: Function syntax

2015-08-13 Thread Tassilo Horn
Amith George writes: >> That's not the same function as #(last (sort %&)) >> The equivalent would be (comp last sort vec) > > Could you please explain why is the `vec` needed? From what I > understand, we are expected to treat the variadic args argument as a > seq, nothing more. With ((comp las

Re: Function syntax

2015-08-13 Thread Amith George
Hi, That's not the same function as #(last (sort %&)) > The equivalent would be (comp last sort vec) Could you please explain why is the `vec` needed? From what I understand, we are expected to treat the variadic args argument as a seq, nothing more. On Thursday, 13 August 2015 14:02:38 UT

Re: Function syntax

2015-08-13 Thread Herwig Hochleitner
2015-08-13 10:08 GMT+02:00 Eric Le Goff : > I would be curious to know if there are difference (in terms of > performance / elegance ) between those 2 ways of expressing functions > > E.g > > *(fn [& x] (-> x sort last))* > > versus > > *#(last (sort %&))* > > Both are supposedly equivalent, but w

Re: Function syntax

2015-08-13 Thread Erik Assum
(comp last sort) Erik. -- i farta > Den 13. aug. 2015 kl. 10.08 skrev Eric Le Goff : > > I would be curious to know if there are difference (in terms of performance / > elegance ) between those 2 ways of expressing functions > > E.g > > (fn [& x] (-> x sort last)) > > versus > > #(last (

Function syntax

2015-08-13 Thread Eric Le Goff
I would be curious to know if there are difference (in terms of performance / elegance ) between those 2 ways of expressing functions E.g *(fn [& x] (-> x sort last))* versus *#(last (sort %&))* Both are supposedly equivalent, but would you recommend one preferred syntax , or this just a matte

Re: Anonymous function syntax in R1053

2008-10-07 Thread Matthew D. Swank
On Oct 7, 12:32 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > On Oct 7, 2008, at 1:21 AM, Matthew D. Swank wrote: ... > Here's a similar question and answer from the list archive that   > includes a cool tip for seeing the effect of reader macros: > > > > > On Fri, Mar 14, 2008 at 11:58

Re: Anonymous function syntax in R1053

2008-10-06 Thread Stephen C. Gilardi
On Oct 7, 2008, at 1:21 AM, Matthew D. Swank wrote: > > Typing #(nil) at a repl gives me: > > java.lang.NullPointerException (NO_SOURCE_FILE:1) > [Thrown class clojure.lang.Compiler$CompilerException] > [...] > However, (fn [] nil) is fine. > > Shouldn't they be equivalent? > > Thanks, > Matt Her

Anonymous function syntax in R1053

2008-10-06 Thread Matthew D. Swank
Typing #(nil) at a repl gives me: java.lang.NullPointerException (NO_SOURCE_FILE:1) [Thrown class clojure.lang.Compiler$CompilerException] Restarts: 0: [ABORT] Return to SLIME's top level. 1: [CAUSE] Throw cause of this exception Backtrace: 0: clojure.lang.Compiler.analyzeSeq(Compiler.ja