transcendental-lisp/lisp/lang/dlambda.lisp

29 lines
785 B
Common Lisp

(load "functions.lisp")
(define-macro dlambda (&rest methods)
(cons
(quote lambda)
(cons
(quote (&rest arguments))
(list
(cons
(quote case)
(cons
(quote (first arguments))
(mapcar
(lambda (method)
(cons
(first method)
(list
(cons
(quote apply)
(cons
(cons
(quote lambda)
(rest method))
(list
(if (equal t (car method))
(quote arguments)
(quote (rest arguments)))))))))
methods)))))))