Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
14
Task/Function-composition/Scheme/function-composition-1.ss
Normal file
14
Task/Function-composition/Scheme/function-composition-1.ss
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(define (compose f g) (lambda (x) (f (g x))))
|
||||
|
||||
;; or:
|
||||
|
||||
(define ((compose f g) x) (f (g x)))
|
||||
|
||||
;; or to compose an arbitrary list of 1 argument functions:
|
||||
|
||||
(define-syntax compose
|
||||
(lambda (x)
|
||||
(syntax-case x ()
|
||||
((_) #'(lambda (y) y))
|
||||
((_ f) #'f)
|
||||
((_ f g h ...) #'(lambda (y) (f ((compose g h ...) y)))))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue