Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Ugly loop

20 views
Skip to first unread message

WJ

unread,
Mar 2, 2015, 5:02:38 PM3/2/15
to
An idiot wrote:

> > It is a conjecture, resulting from applying common sense. Why should
> > one teach something that is a) not properly defined, b) ambiguous and c)
> > totally different in style and workings than the rest of Common Lisp to
> > a new learner of that language, who wants to get a grasp on the
> > essentials and the general feeling of the language first, and not on
> > its, to put it mildly, fanciful outgrowths.
>
> Because (a) it is properly defined, in practice(*), (b) is not ambiguous,
> as actually used, and (c) more concise and understandable than the
> alternatives in Common Lisp.


Dan Weinreb, one of the designers of Common Lisp:

... the problem with LOOP was that it turned out to be hard to
predict what it would do, when you started using a lot of
different facets of LOOP all together. This is a serious problem
since the whole idea of LOOP was to let you use many facets
together; if you're not doing that, LOOP is overkill.


Barry Margolin, 05 Apr 2001:
(http://groups.google.com/group/comp.lang.lisp/msg/8a48cedb8b3bcb52)

>(My second rule of thumb concerning LOOP would be the negative of
>Barry Margolin's: The more complex the looping, the more you need/want
>to use LOOP.)

My recommendation is based on seeing many question in the past of the form
"What happens if you use both XXX and YYY in the same LOOP?" The
unfortunate fact is that when we were writing the standard we didn't have
time to nail down all the possible interactions between different LOOP
features, so many of these are not well specified. And even if we did get
it right in the standard, it's likely to be difficult to find them and I
wouldn't trust that all implementors got it right (many of those questions
were probably from implementors, trying to figure out what they were
supposed to do). And even if they all got it right, someone reading your
code may not be able to figure it out.

So, with all those potential problems, my feeling is that if you have to
ask, it's probably better to use something other than LOOP.


John Foderaro <j...@unspamx.franz.com>:

I'm not trying to join a debate on loop. I just wanted to present
the other side of [the issue so that] the intelligent people can
then weigh the arguments on both sides.

I'm not suggesting that loop can be fixed either by adding
parenthesis or coming up with ways of indenting it to make it
understandable. It's a lost cause.


Paul Graham:

I consider Loop one of the worst flaws in CL, and an example
to be borne in mind by both macro writers and language designers.

WJ

unread,
Mar 2, 2015, 5:29:19 PM3/2/15
to
> But IMHO the main shortcoming of loop is that it isn't complete
> enough. For instance, LOOP would be even more fun if it had general
> sequence accumulation and not only list and number accumulation - I'm
> tired of writing e.g. (coerce (loop ... collect ...) 'string)!

Gauche Scheme:

(use srfi-42) ; string-ec
(string-ec (: c "enn" "," "a`q") (integer->char (+ 1 (char->integer c))))
===>
"foo-bar"

0 new messages