Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,16 @@
(defun compose (f g)
(lambda (x)
(funcall f
(funcall g x))))
(defun compose (funcs)
(lists:foldl #'compose/2
(lambda (x) x)
funcs))
(defun check ()
(let* ((sin-asin (compose #'math:sin/1 #'math:asin/1))
(expected (math:sin (math:asin 0.5)))
(compose-result (funcall sin-asin 0.5)))
(io:format '"Expected answer: ~p~n" (list expected))
(io:format '"Answer with compose: ~p~n" (list compose-result))))

View file

@ -0,0 +1,13 @@
> (funcall (compose #'math:sin/1 #'math:asin/1)
0.5)
0.49999999999999994
> (funcall (compose `(,#'math:sin/1
,#'math:asin/1
,(lambda (x) (+ x 1))))
0.5)
1.5
> (check)
Expected answer: 0.49999999999999994
Answer with compose: 0.49999999999999994
ok
>