Weghalen unresolved labels en update examples
[cc1516.git] / examples / printparse.spl
index 41f1988..6ac6199 100644 (file)
@@ -49,7 +49,7 @@ strToInt(x) :: [Char] -> Int {
 }
 
 //printList(p, l) :: (a -> Void) -> [a] -> Void {
-printList(p, l) :: (a -> Void) -> [a] -> Void {
+printList(p, l) {
     print('[');
        if(!isEmpty(l)){
                p(l.hd);
@@ -65,6 +65,10 @@ printList(p, l) :: (a -> Void) -> [a] -> Void {
 
 printInt(x) {
        [Char] l = [];
+       if(x < 0){
+               print('-');
+               x = -x;
+       }
        while(x > 0){
                l = toChar(x % 10) : l;
                x = x / 10;
@@ -75,5 +79,5 @@ printInt(x) {
 main(){
        var num = "-1234";
 
-       printList(printInt, 32 : 4 : []);
+       printList(printInt, 32 : 4 : strToInt(num) : []);
 }