From: Futu Ranon on
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
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
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
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
"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