transcendental-lisp/lisp/lang/dlambda.lisp

29 lines
785 B
Common Lisp
Raw Normal View History

2017-03-06 11:00:18 -05:00
(load "functions.lisp")
(define-macro dlambda (&rest methods)
(cons
(quote lambda)
(cons
(quote (&rest arguments))
(list
(cons
(quote case)
(cons
(quote (first arguments))
2017-03-02 14:26:47 -05:00
(mapcar
(lambda (method)
(cons
(first method)
(list
(cons
(quote apply)
(cons
(cons
(quote lambda)
2017-03-06 11:00:18 -05:00
(rest method))
2017-03-02 14:26:47 -05:00
(list
(if (equal t (car method))
(quote arguments)
2017-03-06 11:00:18 -05:00
(quote (rest arguments)))))))))
methods)))))))