-Let Int a = 4;
+//Let Int a = 4;//
-mapP1(xs) {
- if(isEmpty(xs)) {
+//mapP1(xs) {
+// if(isEmpty(xs)) {
+// return [];
+// } else {
+// return (xs.hd + 1) : mapP1(xs.tl);
+// }
+//}
+//main() {
+// [Int] x = [];
+// [Int] y = [];
+// Int z = a();
+// x = mapP1(x);
+// y = mapP1(x);
+// return a() + 5;
+//}
+
+plus(x,y){
+ return x+y;
+}
+
+map(f, xs) {
+ if (isEmpty(xs)) {
return [];
} else {
- return (xs.hd + 1) : mapP1(xs.tl);
+ return f(xs.hd) : map(f, xs.tl);
+ }
+}
+
+foldr(f, acc, xs) {
+ if(isEmpty(xs)) {
+ return acc;
+ } else {
+ return foldr(f, f(xs.hd, acc), xs.tl);
}
}
+
main() {
- [Int] x = [];
- [Int] y = [];
- Int z = a();
- x = mapP1(x);
- y = mapP1(x);
- return a() + 5;
+ var f = plus(1);
+ var z = map(f, 1:2:[]);
+ var x = foldr(plus, 0, 1:2:[]);
+ return;
}
\ No newline at end of file