A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
|
|
@ -0,0 +1 @@
|
|||
(defun compose (f g) (lambda (x) (funcall f (funcall g x))))
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
>(defun compose (f g) (lambda (x) (funcall f (funcall g x))))
|
||||
COMPOSE
|
||||
>(let ((sin-asin (compose #'sin #'asin))))
|
||||
(funcall sin-asin 0.5))
|
||||
0.5
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
(defun compose (f g)
|
||||
(eval `(lambda (x) (funcall ',f (funcall ',g x))))
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
CL-USER> (defmacro compose (fn-name &rest args)
|
||||
(labels ((rec1 (args)
|
||||
(if (= (length args) 1)
|
||||
`(funcall ,@args x)
|
||||
`(funcall ,(first args) ,(rec1 (rest args))))))
|
||||
`(defun ,fn-name (x) ,(rec1 args))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue