repositories
/
cc1516.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
lambdas without params, lambdas are now passed as vars instead of funcs
[cc1516.git]
/
examples
/
high.spl
1
plus(x, y) {
2
return x + y;
3
}
4
5
fold(f, b, l) {
6
var x = l;
7
var acc = b;
8
while(!isEmpty(l)){
9
acc = f(acc, x.hd);
10
x = x.tl;
11
}
12
return acc;
13
}
14
15
main (){
16
var a = 1 : 2 : [];
17
var b = fold(plus, 0, a);
18
print(b);
19
}