[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
More on reference/pure data, declaration not really needed
- To: common-lisp%SU-AI@SCORE
- Subject: More on reference/pure data, declaration not really needed
- From: Rem@IMSSS
- Date: Wed, 04 Sep 1985 10:15:00 -0000
After sending that message I realized declarations aren't needed in the
case of (+InPlace Result A B C ... Z). The only true requirement is that
Result get initialized to a modifyable number of the desired type before
calling +InPlace. +InPlace would compute the result as normal, except
being careful not to do any number-consing, then would coerce the result
to the same type as Result previously had, and modify Result to contain
that result.
Note that when you use +InPlace you lose the ability to nest function
calls, thus the in-place-efficient version of (SETQ A (+ B (* C D)))
would be (PROGN (*InPlace A C D) (+InPlace A A B)) using A as a temporary,
although a smart compiler or interpretor ought to be able to recognize
(+InPlace A B (* C D)) and convert it into a totally-efficient calculation
so the user can retain the ability to nest * inside +(InPlace).
-------