Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 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)))))))
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
(display ((compose sin asin) 0.5))
|
||||
(newline)
|
||||
|
|
@ -0,0 +1 @@
|
|||
0.5
|
||||
Loading…
Add table
Add a link
Reference in a new issue