The easiest way to understand this idiom is a simple merge that constructs a new list as output.
(defun merj (x y)
(if (null x)
y
(if (null y)
x
(if (< (first x) (first y))
(cons (first x)
(merj (rest x) y))
(cons (first y)
(merj x (rest y))) ) ) ) )
public static Cons merj (Cons x, Cons y) {
if ( x == null )
return y;
else if ( y == null )
return x;
else if ( ((Comparable) first(x))
.compareTo(first(y)) < 0 )
return cons(first(x),
merj(rest(x), y));
else return cons(first(y),
merj(x, rest(y))); }
What is O()? Stack depth? Conses?
Contents    Page-10    Prev    Next    Page+10    Index