Name: Anonymous 2009-10-28 21:29
Name one noteworthy program that was coded in LISP.
I'll wait.
I'll wait.
MAPLIST PUSH CONS FIRST/REST/CAR/CDR/CDAR SORT SET-DIFFERENCE REMOVE NREVERSE and some others, to implement a simple grpah manipulation algorithm. The C version had done the same things, but in an ad-hoc manner, leading to a lot of code duplication. I'm sure I could have factored away most of the similar code patterns, had I known Lisp before I wrote the C version, but alas that was a long time ago. Here's a sample of one of the functions used by it:
(defun seq (n m)
(loop for i from n to m collect i))
(defun compute-graph
(removal-order &optional (n (+ 2 (length removal-order))))
(let ((vertex-bag (seq 1 n))
edges)
(maplist #'(lambda (order)
(push
(cons
(let ((next-vertex
(first (sort (set-difference vertex-bag order) #'<))))
(setf vertex-bag (remove next-vertex vertex-bag))
next-vertex)
(first order))
edges))
removal-order)
(let ((last-vertex (cdar edges)))
(push (cons (car (remove last-vertex vertex-bag))
last-vertex) edges))
(nreverse edges)))