2017-03-02 14:26:47 -05:00
|
|
|
(defun mapcar (fn ls)
|
2017-03-01 16:33:06 -05:00
|
|
|
(if (null ls)
|
|
|
|
()
|
2017-03-02 14:26:47 -05:00
|
|
|
(cons
|
|
|
|
(funcall fn (first ls))
|
|
|
|
(mapcar fn (rest ls))
|
2017-03-01 16:33:06 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(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
|
2017-03-01 16:33:06 -05:00
|
|
|
(lambda (method)
|
|
|
|
(cons
|
|
|
|
(first method)
|
|
|
|
(list
|
|
|
|
(cons
|
|
|
|
(quote apply)
|
|
|
|
(cons
|
|
|
|
(cons
|
|
|
|
(quote lambda)
|
|
|
|
(rest method)
|
|
|
|
)
|
2017-03-02 14:26:47 -05:00
|
|
|
(list
|
|
|
|
(if (equal t (car method))
|
|
|
|
(quote arguments)
|
|
|
|
(quote (rest arguments))
|
|
|
|
)
|
|
|
|
)
|
2017-03-01 16:33:06 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
methods
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|