transcendental-lisp/lisp/dlambda.lisp

47 lines
917 B
Common Lisp
Raw Normal View History

(defun map (fn ls)
(if (null ls)
()
(cons (funcall fn (first ls))
(map fn (rest ls))
)
)
)
(define-macro dlambda (&rest methods)
(cons
(quote lambda)
(cons
(quote (&rest arguments))
(list
(cons
(quote case)
(cons
(quote (first arguments))
(map
(lambda (method)
(cons
(first method)
(list
(cons
(quote apply)
(cons
(cons
(quote lambda)
(rest method)
)
(list (quote (rest arguments)))
)
)
)
)
)
methods
)
)
)
)
)
)
)