// }
//}
-plus(x, y){
+plus3(x, y, z){
return x + y;
}
+plus(x, y){
+ return x+y;
+}
+
apply(f, x){
return f(x);
}
+ap2(f, g, x){
+ return f(g(x));
+}
+
main(){
// 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("sum of 0..12 but only the evens: ",
// foldr(\x y->x+y, 0, filter(\x->x%2 == 0, intList(12))));
- var a = plus(3);
- var b = apply(a);
- var c = apply(b);
- var d = apply(c);
- var e = apply(d);
- var f = apply(e);
- var g = apply(f);
- var h = apply(g);
- var i = apply(h);
- var j = apply(i);
- var k = apply(j);
- var l = apply(k);
- var m = apply(l);
- var n = apply(m);
- var o = apply(n);
- var p = apply(o);
- var q = apply(p);
- var r = apply(q);
- var s = apply(r);
- var t = apply(s);
- var u = apply(t);
- var v = apply(u);
- var w = apply(v);
- var x = apply(w);
- var y = apply(x);
- var z = apply(y);
-
- print("3+5=", z(5));
+ var a = plus3;
+ var b = a(1);
+ var c = b(2);
+ var d = c(3);
}
print(l);
}
+printBool(b) :: Bool -> Void {
+ print(b);
+}
+
main(){
var num = "-1234";
printList(printInt, [32, 4, strToInt(num)]);
+// printList(printBool, [True, False, True, True]);
}
//Identifier points to function
Just (LAB l arity fn) = if (arity <> (length es))
//Function is not complete
- ( tell
+ ( mapM_ g es
+ >>| tell
[Instr "ldc" [Lit fn] "Store function number"
,Instr "sth" [] ""
+ ,Instr "str" [Raw "R7"] ""
,Instr "ldc" [Lit $ length es] "Store arity"
,Instr "sth" [] ""
- ,Instr "ajs" [Lit -1] ""]
- >>| mapM_ g es
+ ,Instr "ajs" [Lit -1] ""
+ ]
>>| if (isEmpty es) (pure ()) (tell
[Instr "stmh" [Lit $ length es] "Store arguments"
- ,Instr "ajs" [Lit -1] ""]))
+ ,Instr "ajs" [Lit -1] ""
+ ,Instr "ldr" [Raw "R7"] ""]))
//Function is complete
( mapM_ g es
>>| getAdressbook >>= \ab->(case 'Map'.get k ab of