Map can apply a two or more parameter function to sequential members of two or more lists viz:
> (define (two_ops x y) (+ x y))
(lambda (x y) (+ x y))
> (map two_ops '(1 2 3) '(4 5 6))
(5 7 9)
but it doesn't look like that's what you are after?
Don't know if these help:
Maybe see
http://www.delorie.com/gnu/docs/emacs/cl_47.html
that seems to suggest using an underlying looping macro:
...
Function: reduce function seq &key :from-end :start :end :initial-value :key
This function combines the elements of seq using an associative binary operation. Suppose function is * and seq is the list (2 3 4 5). The first two elements of the list are combined with (* 2 3) = 6; this is combined with the next element, (* 6 4) = 24, and that is combined with the final element: (* 24 5) = 120. Note that the * function happens to be self-reducing, so that (* 2 3 4 5) has the same effect as an explicit call to reduce.
If :from-end is true, the reduction is right-associative instead of left-associative:
(reduce '- '(1 2 3 4))
== (- (- (- 1 2) 3) 4) => -8
(reduce '- '(1 2 3 4) :from-end t)
== (- 1 (- 2 (- 3 4))) => -2
If :key is specified, it is a function of one argument which is called on each of the sequence elements in turn.
If :initial-value is specified, it is effectively added to the front (or rear in the case of :from-end) of the sequence. The :key function is not applied to the initial value.
If the sequence, including the initial value, has exactly one element then that element is returned without ever calling function. If the sequence is empty (and there is no initial value), then function is called with no arguments to obtain the return value.
All of these mapping operations can be expressed conveniently in terms of the loop macro. In compiled code, loop will be faster since it generates the loop as in-line code with no function calls.
While
http://t3x.dyndns.org/LISP/CL/reduce.html
suggests:
REDUCE
Purpose:
Reduce a list. Combine the first member of the list with the reduced rest of the list using a given function. Arguments:
A - list to reduce
X - default member (replaces NIL)
F - combining function
Model:
(defun reduce (a x f)
(cond ((null a) x)
(t (f (car a) (reduce (cdr a) x f)))))
Implementation:
(defun reduce (a x f)
(label ((red (lambda (a b)
(cond ((null a) b)
((null b) (red (cdr a) (f (car a) x)))
(t (red (cdr a) (f (car a) b)))))))
(red (reverse a) nil)))