Re: Idiomatic lisp - loops



On 2007-03-16 14:00:40 -0400, oversby@xxxxxxxxxxxxxx said:

I'm trying to write a loop that inserts a dotted key/value pair in
order into a list of ordered
key/value pairs.

If this is what you're really tying to do:

* (defun kv-insert (list elt) (stable-sort (push elt list) #'string< :key #'car))

KV-INSERT
* (kv-insert (list (cons "alpha" "zeta") (cons "beta" "delta") (cons "zeta" "eta")) (cons "sigma" "gamma"))

(("alpha" . "zeta") ("beta" . "delta") ("sigma" . "gamma") ("zeta" . "eta"))
*

.