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

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

RE: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql'


From: Drew Adams
Subject: RE: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql'
Date: Thu, 29 Dec 2022 22:41:53 +0000

> Applicative order AKA strict evaluation: a function is
> undefined if any of its arguments are.
> 
> So in practice, that means they are computed first.
> 
> And that makes sense! Since a function f(x, y) is very much
> a function of x and y ...

Uh, being a function of x and y doesn't imply
that both x and y always need to be known
(calculated).

`if' is a function of all of its args, but in
some cases it need not evaluate all of them.

Same with `*': if one of the args is zero then
no need to calculate the others.  Etc.

With normal order evaluation you can evaluate
only the args that are needed, based on what
those args are.

For instance, with applicative order you can't
define `if' as a function.  With normal order
you can.

With applicative order some calculations never
end (bottom), while the same function definition
might end with normal order.

And besides never ending, with appl. order you
can do a lot of unnecessary calculation - for
args that the function doesn't end up using.

In general, applicative order is a kludge.  But
it's a simple one, and generally efficient.

To make normal order etc. evaluation efficient
you need to make it _fully_ lazy: don't copy
or evaluate the same expression multiple times,
but use graph reduction (sharing) instead.



reply via email to

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