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

Re: What to do with (time (length L)) proportional to (length L)

19 views
Skip to first unread message

WJ

unread,
Mar 24, 2015, 1:38:15 AM3/24/15
to
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
Pascal Costanza wrote:

> (let* ((temp1 (mapcar #'f1 some-list))
> (temp2 (mapcar #'f2 temp1))
> (temp3 (mapcar #'f3 temp2)))
> (mapcar #'f4 temp3))
>
> You could better say:
>
> (loop for elem in some-list
> collect (f4 (f3 (f2 (f1 elem)))))

Wrong.

Moronity is rampant among worshippers of CL (COBOL-Like).

Gauche Scheme:

(map (^x (f4 (f3 (f2 (f1 x))))) some-list)

Or use function composition:

(map (.$ f4 f3 f2 f1) some-list)


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.


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:

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.

WJ

unread,
Jun 18, 2016, 2:15:52 PM6/18/16
to
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
OCaml:

List.map (fun x -> f4 (f3 (f2 (f1 x)))) some_list

--
Jews totally run Hollywood.... But I don't care if Americans think we're
running the news media, Hollywood, Wall Street or the government. I just care
that we get to keep running them. --- Joel Stein
articles.latimes.com/2008/dec/19/opinion/oe-stein19
archive.org/download/DavidDukeTv/DoJewsControlTheMediaTheLaTimesSaysYes.flv

WJ

unread,
Oct 15, 2016, 3:47:42 PM10/15/16
to
WJ wrote:

> Pascal Costanza wrote:
>
> > (let* ((temp1 (mapcar #'f1 some-list))
> > (temp2 (mapcar #'f2 temp1))
> > (temp3 (mapcar #'f3 temp2)))
> > (mapcar #'f4 temp3))
> >
> > You could better say:
> >
> > (loop for elem in some-list
> > collect (f4 (f3 (f2 (f1 elem)))))
>
> Wrong.
>
> Moronity is rampant among worshippers of CL (COBOL-Like).
>
> Gauche Scheme:
>
> (map (^x (f4 (f3 (f2 (f1 x))))) some-list)
>
> Or use function composition:
>
> (map (.$ f4 f3 f2 f1) some-list)

MatzLisp (Ruby):

[-2,3,4].map{|n| Math.sqrt(n.abs)}
==>[1.4142135623730951, 1.7320508075688772, 2.0]
0 new messages