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


    Date: Wednesday, 25 May 1983, 13:29-EDT
    From: Bernard S. Greenberg <BSG%SCRC-TENEX at MIT-ML>
    Re:   REDUCE Change

    It is not at all consistent with the rest of the definition of the 
    function.  The specific (reduce '(foo) #'+) example in the manual
    seems to me counterintuitive.  I guess my big complaint is that this
    "feature" does not fall out of the code nicely at all, and the amount
    of code spent worrying about it, given indefinite list ends, :from-end,
    etc., is almost equal to that of the rest of the function.  

My intuition about and implementation of REDUCE are exactly opposite yours, I
guess, since this special case does fall nicely out of my code.  If no initial
value is supplied, I grab the first (or last if we're :from-ending it) element
from the specified subsequence and restrict the bounds by one.  Then I enter a
loop calling the function until the subsequence is exhausted.  So the function
is never called.  The case of passing in a null sequence with no initial value
is handled entirely separately.  So

	(reduce #'+ '(2))  <==>  (reduce #'+ '() :initial-value 2).