Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Function-composition/Fantom/function-composition.fantom
Normal file
15
Task/Function-composition/Fantom/function-composition.fantom
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
class Compose
|
||||
{
|
||||
static |Obj -> Obj| compose (|Obj -> Obj| fn1, |Obj -> Obj| fn2)
|
||||
{
|
||||
return |Obj x -> Obj| { fn2 (fn1 (x)) }
|
||||
}
|
||||
|
||||
public static Void main ()
|
||||
{
|
||||
double := |Int x -> Int| { 2 * x }
|
||||
|Int -> Int| quad := compose(double, double)
|
||||
echo ("Double 3 = ${double(3)}")
|
||||
echo ("Quadruple 3 = ${quad (3)}")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue