help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [External] : Re: Closures - do you understand them well?


From: Emanuel Berg
Subject: Re: [External] : Re: Closures - do you understand them well?
Date: Thu, 22 Dec 2022 00:53:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Drew Adams wrote:

>>> Indeed, when I looked at it, I decided it was too much
>>> trouble figuring out how to change `cl-loop` to provide
>>> that behavior :-( IMO `cl-loop` is too complex for its
>>> own good.
>> 
>> All of Lisp is, and the reason is it's so simple to begin
>> with ...
>
> Most likely Stefan meant that the code implementing
> `cl-loop' is complex - even too complex for its own good
> (it's a bother to maintain/improve/correct).

Okay, maybe that complexity have something to do with the huge
scope of what you can do with that in so many ways?

And why I think it's cool with things that breaks the
pattern ...

I don't want a lot of Lisp, the Lisp I use, to be like that.

But it's fun, it feels like the land of total loop freedom
which I didn't know existed :)

In the computer books I read as a kid they always said the for
loop was much more modern an better than the while loop, the
do ... until loop, and wasn't there a 'wend' loop as well,
whatever that did.

I believed it then, now I'm so sure. The while loop is useful
and the for loop is useful, but, for specific datastructures,
there should be specific loops, one shouldn't, IMO, iterate
that manually with the for-increment-i unless there is some
extra spanner one wants to throw somewhere in particular which
the standard datastructure-loop function doesn't do ...

The result of that will also be a nice set of often use
datastructures, all with associated, trusted loop functions
people can the compete to optimize. So it's de facto
standardization which leads to, yeah, better code and better
software I guess.

So yeah, in a way cl-loop in all it's scope is like the
opposite of that, instead of nicely dedicated it can do
everything - including being dedicated because it has that as
well - but again, I'm a maximalist, I don't want what's best
or makes the most sense, well I want that as well, because
I want EVERYTHING!

> But it's also the case that for a _user_ the syntax
> of `(cl-)loop' is complex - certainly much more
> complex than the usual Lisp syntax.  You essentially
> have to learn another language - `loop' - to use it.

Maybe an exaggeration but in a matter of speaking, yes, in
particular the 'with i = 0' looks like, I don't now, some
dialect of SQL?

> That's one of the arguments in favor of using macro
> `iterate' instead: its syntax is more "lispy".

`cl-loop' is, or can be, much less lispy, yes.

> Users can of course learn the language of `loop',
> just as they can learn the language of Unix `find',
> and just as they can learn the language (patterns)
> of regular expressions, or those of `pcase'.

With `cl-loop' it's too much, no doubt about it, still it's
there so why reduce it if it's useful. I would stop using it
if all of Elisp was like that but it isn't so hey, relax.
`cl-loop is cool B) It is much more powerful (expressive) than
the C or C++ for loop in ways that I do understand, and
I don't understand all if (cl-lib), by far :)

> Nevertheless, it remains true that a second/separate
> language is introduced. That can present advantages (code
> can often look like simple English commands), but it also
> presents disadvantages.

Indeed, keep Lisp the old way, no more `cl-loop' style stuff and
where it appear, don't put everything in one function, is what
I wouldn't do!

> It's largely a question of taste/style, and
> "Des goƻts

Interesting so "circumflex DNC" (line 83) in the Linux VT:

  https://dataswamp.org/~incal/conf/vt/remap.inc

> (The rule behind Occam's taste & color preferences, perhaps,
> but a good rule of thumb nevertheless. The taste question
> comes in when deciding just which multiplying is
> "unnecessary".)

Whaat???

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]