Reduce in Lisp

The function reduce applies a specified function to the first two elements of a list, then to the result of the first two and the third element, and so forth.

>(reduce '+ '(1 2 3 17))


>(reduce '* '(1 2 3 17))


reduce is just what we need to process a result from mapcan:

>(reduce '+ (mapcan 'testforz
                    '(z m u l e z r u l e z)))


Contents    Page-10    Prev    Next    Page+10    Index