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/REBOL/function-composition-1.rebol
Normal file
14
Task/Function-composition/REBOL/function-composition-1.rebol
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
REBOL [
|
||||
Title: "Functional Composition"
|
||||
URL: http://rosettacode.org/wiki/Functional_Composition
|
||||
]
|
||||
|
||||
; "compose" means something else in REBOL, therefore I use a 'compose-functions name.
|
||||
|
||||
compose-functions: func [
|
||||
{compose the given functions F and G}
|
||||
f [any-function!]
|
||||
g [any-function!]
|
||||
] [
|
||||
func [x] compose [(:f) (:g) x]
|
||||
]
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
foo: func [x] [reform ["foo:" x]]
|
||||
bar: func [x] [reform ["bar:" x]]
|
||||
|
||||
foo-bar: compose-functions :foo :bar
|
||||
print ["Composition of foo and bar:" mold foo-bar "test"]
|
||||
|
||||
sin-asin: compose-functions :sine :arcsine
|
||||
print [crlf "Composition of sine and arcsine:" sin-asin 0.5]
|
||||
Loading…
Add table
Add a link
Reference in a new issue