repositories
/
cc1516.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
550c1b6
)
pim
author
Mart Lubbers
<mart@martlubbers.net>
Thu, 26 May 2016 16:54:17 +0000
(18:54 +0200)
committer
Mart Lubbers
<mart@martlubbers.net>
Thu, 26 May 2016 16:54:17 +0000
(18:54 +0200)
examples/higher.spl
patch
|
blob
|
history
diff --git
a/examples/higher.spl
b/examples/higher.spl
index
66f9024
..
0cd83de
100644
(file)
--- a/
examples/higher.spl
+++ b/
examples/higher.spl
@@
-36,12
+36,22
@@
intList(x){
return l;
}
return l;
}
+printIntList(l) :: [Int] -> Void{
+ print('[');
+ if(!isEmpty(l)){
+ print(l.hd);
+ l = l.tl;
+ }
+ while(isEmpty(l)){
+ print(", ", l.hd);
+ l = l.tl;
+ }
+ print("]\n");
+}
+
main(){
main(){
- print(
- "faculty of 5 is: ",
- foldr(\x y->x*y, 1, intList(z)),
- "sum of 1..5 is: ",
- foldr(\x y->x+y, 0, intList(z)),
- "filter evens from 0..12 is: ",
- filter(\x->x % 2 == 0, intList(12)));
+ print("faculty of 5 is: ", foldr(\x y->x*y, 1, intList(5)));
+ print("sum of 1..5 is: ", foldr(\x y->x+y, 0, intList(5)));
+ print("filter evens from 0..12 is: ");
+ printIntList(filter(\x->x%2 == 0, intList(12)));
}
}