Multiple Substitutions
The function (sublis alist form) makes multiple substitutions simultaneously:
; replace by by in
>(sublis '((rose peach) (smell taste))
'(a rose by any other name
would smell as sweet))
(a peach by any other name would taste as sweet)
; substitute in form with bindings in alist
(defn sublis [alist form]
(if (cons? form)
(cons (sublis alist (first form))
(sublis alist (rest form)))
(let [binding (assocl form alist)]
(if binding ; (name value) or nil
(second binding)
form) ) ) )