From: Futu Ranon on 3 Mar 2010 09:12 In Pillsy's "Redirecting program output with SBCL's RUN-PROGRAM", I noticed the following: > (loop > :for line := (read-line o nil nil) > :while line > :collect line)) Is this "typical" style? I have always seen it in reading and in practice as: > (loop > for line = (read-line o nil nil) > while line > collect line)) Thank you.
From: Giovanni Gigante on 3 Mar 2010 09:26 Futu Ranon wrote: > Is this "typical" style? Not very common, but possible. Personally, I adopted it when i realized that since in SLIME keywords are shown in a different color, this style makes the loop form somewhat easier to read (to my eyes, at least).
From: Tamas K Papp on 3 Mar 2010 09:43 On Wed, 03 Mar 2010 15:26:46 +0100, Giovanni Gigante wrote: > Futu Ranon wrote: >> Is this "typical" style? > > Not very common, but possible. Personally, I adopted it when i realized > that since in SLIME keywords are shown in a different color, this style > makes the loop form somewhat easier to read (to my eyes, at least). At it also looks nice in other, similar macros, eg iterate (for all the keywords but the first, where you can't use it). Tamas
From: Pascal Costanza on 3 Mar 2010 10:00 On 03/03/2010 15:12, Futu Ranon wrote: > In Pillsy's "Redirecting program output with SBCL's RUN-PROGRAM", I > noticed the following: > >> (loop >> :for line := (read-line o nil nil) >> :while line >> :collect line)) > > Is this "typical" style? I have always seen it in reading and in > practice as: > >> (loop >> for line = (read-line o nil nil) >> while line >> collect line)) Both styles are common. Pascal -- My website: http://p-cos.net Common Lisp Document Repository: http://cdr.eurolisp.org Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Pascal J. Bourguignon on 4 Mar 2010 03:55 "Futu Ranon" <futuranon(a)gmail.com> writes: > In Pillsy's "Redirecting program output with SBCL's RUN-PROGRAM", I > noticed the following: > >> (loop >> :for line := (read-line o nil nil) >> :while line >> :collect line)) > > Is this "typical" style? I have always seen it in reading and in > practice as: > >> (loop >> for line = (read-line o nil nil) >> while line >> collect line)) > > Thank you. In case of interactive use, the former has the advantage of not interning symbols such as FOR and WHILE which may be later imported by a USE-PACKAGE form, thus avoiding conflict. This is what motivated to use keywords in LOOP. (I had macros named FOR and WHILE in some utility package). -- __Pascal Bourguignon__ http://www.informatimago.com
|
Next
|
Last
Pages: 1 2 Prev: A couple of questions on lisp compiler/optimization art Next: uw-p and make-thread |