next up previous contents index
Next: Higher Order Functions Up: Insertion Sort Previous: sorted insertion into a   Contents   Index

'insertion-sort'


\begin{lstlisting}[language=Scm]{}
(define insertion-sort
(lambda(l)
(if (nullp l)
nil
(insert (car l)
(insertion-sort (cdr l))))))
\end{lstlisting}

\begin{lstlisting}[language=Scm]{}
(define l1 (cons four
(cons one
(cons thr...
...
--> 4
1
3
2
;
(ldisp! (insertion-sort l1))
--> 1
2
3
4
\end{lstlisting}



Georg P. Loczewski 2004-03-05

Impressum und Datenschutz