Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
15
Task/First-class-functions/Sidef/first-class-functions.sidef
Normal file
15
Task/First-class-functions/Sidef/first-class-functions.sidef
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
func compose(f,g) {
|
||||
func (*args) {
|
||||
f(g(args...));
|
||||
}
|
||||
}
|
||||
|
||||
var cube = func(a) { a.pow(3) };
|
||||
var croot = func(a) { a.root(3) };
|
||||
|
||||
var flist1 = [Math.method(:sin), Math.method(:cos), cube];
|
||||
var flist2 = [Math.method(:asin), Math.method(:acos), croot];
|
||||
|
||||
flist1.range.each { |i|
|
||||
say compose(flist1[i], flist2[i])(0.5);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue