Re: prog1

2013-05-13 Thread Christophe Grand
Hi On Sat, Nov 8, 2008 at 5:10 PM, Robert Pfeiffer < pfeiffer.rob...@googlemail.com> wrote: > Is there a benefit in implementing this as a macro instead of a > function? The function version would be very simple: > > (defn returning [returnval & body] >returnval) > The macro does not alloca

Re: prog1

2008-11-08 Thread Matthias Benkard
p of my head: multiple-value returns and special treatment at the top level), so it'd be a bit weird and maybe even confusing for PROG1 or PROG2 to be such. Matthias --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: prog1

2008-11-08 Thread Michael Wood
On Sat, Nov 8, 2008 at 8:48 PM, André Thieme <[EMAIL PROTECTED]> wrote: > > On 8 Nov., 18:00, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: >> Hi, >> >> Am 08.11.2008 um 17:39 schrieb Meikel Brandmeyer: >> >> >> (defn returning [returnval & body] >> >> returnval) [...] > I also don't see how the f

Re: prog1

2008-11-08 Thread Phlex
André Thieme wrote: > On 8 Nov., 17:47, Phlex <[EMAIL PROTECTED]> wrote: > >> Robert Pfeiffer wrote: >> >>> Is there a benefit in implementing this as a macro instead of a >>> function? The function version would be very simple: >>> >>> (defn returning [returnval & body] >>>re

Re: prog1

2008-11-08 Thread Randall R Schulz
On Saturday 08 November 2008 10:44, André Thieme wrote: > On 8 Nov., 18:32, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > > Hi, > > > > Am 08.11.2008 um 17:58 schrieb Randall R Schulz: > > > Peasant? Or did you mean "pedant?" > > > > In german there is the word "Banause" which translates > > acco

Re: prog1

2008-11-08 Thread André Thieme
On 8 Nov., 18:00, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi, > > Am 08.11.2008 um 17:39 schrieb Meikel Brandmeyer: > > >> (defn returning [returnval & body] > >>  returnval) > > And another question, which a I got when I read the > mail of Phlex: Is the order of evaluation of function > ar

Re: prog1

2008-11-08 Thread André Thieme
On 8 Nov., 18:32, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi, > > Am 08.11.2008 um 17:58 schrieb Randall R Schulz: > > > Peasant? Or did you mean "pedant?" > > In german there is the word "Banause" which translates > according the dictionary to "peasant". It means something > like the follo

Re: prog1

2008-11-08 Thread André Thieme
y] > >    returnval) > > Well no, the forms are evaluated. It's usefull for side effects. In what way would the forms *not* get evaluated when using Roberts function returning? > user> (def *bleh* (ref nil)) > user> (prog1 >         (dosync (ref-set *bleh* 3)) >  

Re: prog1

2008-11-08 Thread Meikel Brandmeyer
Hi, Am 08.11.2008 um 17:58 schrieb Randall R Schulz: Peasant? Or did you mean "pedant?" In german there is the word "Banause" which translates according the dictionary to "peasant". It means something like the following: Artist: "Oh! Look this beautiful picture! It's art!" Banause: "It's jus

Re: prog1

2008-11-08 Thread Meikel Brandmeyer
Hi, Am 08.11.2008 um 17:39 schrieb Meikel Brandmeyer: (defn returning [returnval & body] returnval) And another question, which a I got when I read the mail of Phlex: Is the order of evaluation of function arguments guaranteed to be from the left to the right? Sincerely Meikel smime.p7s D

Re: prog1

2008-11-08 Thread Randall R Schulz
On Saturday 08 November 2008 08:39, Meikel Brandmeyer wrote: > Hi, > > Am 08.11.2008 um 17:10 schrieb Robert Pfeiffer: > > Is there a benefit in implementing this as a macro instead of a > > function? The function version would be very simple: > > > > (defn returning [returnval & body] > > retur

Re: prog1

2008-11-08 Thread Phlex
s usefull for side effects. user> (def *bleh* (ref nil)) user> (prog1 (dosync (ref-set *bleh* 3)) (println (str "bleh is now " @*bleh*))) bleh is now 3 3 A function would work : (defn progz [return-value do-also-fn] (do-also-fn) return-value) us

Re: prog1

2008-11-08 Thread Meikel Brandmeyer
Hi, Am 08.11.2008 um 17:10 schrieb Robert Pfeiffer: Is there a benefit in implementing this as a macro instead of a function? The function version would be very simple: (defn returning [returnval & body] returnval) Although I'm a strong proponent of using macros only where they are really n

Re: prog1

2008-11-08 Thread Robert Pfeiffer
Hello, Is there a benefit in implementing this as a macro instead of a function? The function version would be very simple: (defn returning [returnval & body] returnval) This is just a K combinator with varargs. Robert Pfeiffer --~--~-~--~~~---~--~~ You recei

Re: prog1

2008-11-08 Thread Stephen C. Gilardi
On Nov 8, 2008, at 5:55 AM, Phlex wrote: > Hello, > > I was missing the prog1 macro from common lisp, so here it is. > > (defmacro prog1 [& body] > " (prog1 forms*) > Evaluates all the forms, returning the result of the first form" > `(let [res

prog1

2008-11-08 Thread Phlex
Hello, I was missing the prog1 macro from common lisp, so here it is. (defmacro prog1 [& body] " (prog1 forms*) Evaluates all the forms, returning the result of the first form" `(let [result# ~(first body)] ~@(rest body) result#)) user> (prog1 "a" &qu