next up previous contents index
Next: rest Up: ListType Previous: first   Contents   Index


merge!


Usage

merge!($l_1,l_2$)
merge!($l_1,l_2$, f)


Signature

merge!: (%,%,(T,T) $\to$ Boolean) $\to$ %


Parameter Type Description
$l_1,l_2$ % sorted lists
f (T, T) $\to$ Boolean a comparison function


Description

Given sorted $l_i = [t_{i1},t_{i2},\dots]$ where $f(t_{ij}, t_{ik})$ is true whenever $j < k$, returns the list containing all the elements of $l_1$ and $l_2$, sorted using the ordering $x < y \iff f(x,y)$. The comparison function $f$ is optional if $T$ has TotallyOrderedType, in which case the order function of $T$ is taken.


Remarks

merge! does not make copies of $l_1$ and $l_2$, which are therefore modified after the call. It is unsafe to use the variable $l_1$ and $l_2$ after the call, unless the result of the call has been assigned, as in l := merge!($l_1,l_2$).


See Also

sort!



Manuel Bronstein 2004-06-28