Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
16
Task/Function-composition/LFE/function-composition-1.lfe
Normal file
16
Task/Function-composition/LFE/function-composition-1.lfe
Normal 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))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue