(+ 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, [email protected] wrote:

Maybe it's inconsistent with (apply + a b) where
there's only one evaluation of a and b?  Hmmm.

_______________________________________________
Cmdist mailing list
[email protected]
https://cm-mail.stanford.edu/mailman/listinfo/cmdist

_______________________________________________
Cmdist mailing list
[email protected]
https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to