diff --git a/ccmeta.leg b/ccmeta.leg index fd85f7d..9900fca 100644 --- a/ccmeta.leg +++ b/ccmeta.leg @@ -1298,18 +1298,17 @@ language printLang = C; oop outputProgram= 0; oop mapFunction(oop func, oop args) { - println(args); oop mapValue = makeMap(); - oop argsObj = eval(globals, args); - int size = map_size(argsObj); + int size = map_size(eval(globals, args)); for(int i = 0; i < size; i++) { oop oopInt = makeInteger(i); oop obj = map_get(map_get(args, value_symbol), oopInt); - obj = newCall(func, obj); + oop test = makeMap(); + map_append(test, obj); + obj = newCall(func, test); map_append(mapValue, obj); } map_set(args, value_symbol, mapValue); - println(args); return args; } @@ -2694,6 +2693,7 @@ oop mulOperation(oop lhs, oop rhs) CASE(Float , Float ): return makeFloat(get(lhs, Float, _value) * get(rhs, Float, _value)); CASE(String , Integer): return string_mul(lhs, rhs); CASE(Integer, String ): return string_mul(rhs, lhs); + CASE(Undefined, Integer): return makeInteger(getInteger(rhs)); } runtimeError("multiplication between two incompatible types"); return NULL; // to prevent: control may reach end of non-void function diff --git a/tests-parsimony/map.c b/tests-parsimony/map.c new file mode 100644 index 0000000..e3325cc --- /dev/null +++ b/tests-parsimony/map.c @@ -0,0 +1,8 @@ +@{ + test(foo) { + foo * 10; + } +} + +@{print(map(test, [1, 2, 3]));} + diff --git a/tests-parsimony/tmp.c b/tests-parsimony/tmp.c deleted file mode 100644 index b57cf60..0000000 --- a/tests-parsimony/tmp.c +++ /dev/null @@ -1,12 +0,0 @@ -@{ - test(foo) { - foo * 2; - } - // print("after test decl\n"); - // a = [1, 2, 3]; - // print(a[3]); - // print("\n"); -} - -@{print(map(test, [1, 2, 3]));} -// @{print(test(1));}