Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Function-composition/Objeck/function-composition.objeck
Normal file
29
Task/Function-composition/Objeck/function-composition.objeck
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
bundle Default {
|
||||
class Test {
|
||||
@f : static : (Int) ~ Int;
|
||||
@g : static : (Int) ~ Int;
|
||||
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
compose := Composer(F(Int) ~ Int, G(Int) ~ Int);
|
||||
compose(13)->PrintLine();
|
||||
}
|
||||
|
||||
function : F(a : Int) ~ Int {
|
||||
return a + 14;
|
||||
}
|
||||
|
||||
function : G(a : Int) ~ Int {
|
||||
return a + 15;
|
||||
}
|
||||
|
||||
function : Compose(x : Int) ~ Int {
|
||||
return @f(@g(x));
|
||||
}
|
||||
|
||||
function : Composer(f : (Int) ~ Int, g : (Int) ~ Int) ~ (Int) ~ Int {
|
||||
@f := f;
|
||||
@g := g;
|
||||
return Compose(Int) ~ Int;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue