[CM] Bug in (apply set! ..)
Elijah Stone
elronnd at elronnd.net
Mon Feb 21 16:20:44 PST 2022
(+ a b) ;evaluates a and b once each
(apply + a b ()) ;evaluates a and b once each
(set! a b) ;evaluates a zero times and b once
(apply set! a b ()) ;evaluates a once and b twice
Making the last form apply a and b once each would also be inconsistent: b
is supposed to be evaluated more times than a. What would be fully
consistent is if (apply + a b ()) evaluated a and b _twice_ each; but that
would be bizarre, incompatible, and broadly terrible.
(Another thing that comes to mind is to not let apply evaluate any of the
arguments to the function to be applied. But you have problems with the
tail; how do you handle (apply + (list 1 2))? Well, you could have a
'funcall', which does not need to deal with a tail. But then (funcall f x
y) would be the same as (f x y) in all cases...)
Finally, I will note there is a simple solution to the original problem:
(set! ((curlet) x) 'bar).
-E
On Mon, 21 Feb 2022, bil at ccrma.Stanford.EDU wrote:
> Maybe it's inconsistent with (apply + a b) where
> there's only one evaluation of a and b? Hmmm.
>
> _______________________________________________
> Cmdist mailing list
> Cmdist at ccrma.stanford.edu
> https://cm-mail.stanford.edu/mailman/listinfo/cmdist
>
More information about the Cmdist
mailing list