diff --git a/ulisp-arm.ino b/ulisp-arm.ino index 76bf11b..b2961d0 100644 --- a/ulisp-arm.ino +++ b/ulisp-arm.ino @@ -1,5 +1,5 @@ -/* uLisp ARM Version 4.0 - www.ulisp.com - David Johnson-Davies - www.technoblogy.com - 7th July 2021 +/* uLisp ARM Version 4.0a - www.ulisp.com + David Johnson-Davies - www.technoblogy.com - 9th July 2021 Licensed under the MIT license: https://opensource.org/licenses/MIT */ @@ -1585,7 +1585,7 @@ object *closure (int tc, symbol_t name, object *function, object *args, object * return tf_progn(function, *env); } -object *apply (symbol_t name, object *function, object *args, object *env) { +object *apply (builtin_t name, object *function, object *args, object *env) { if (symbolp(function)) { builtin_t fname = builtin(function->name); if ((fname > FUNCTIONS) && (fname < KEYWORDS)) { @@ -1594,15 +1594,15 @@ object *apply (symbol_t name, object *function, object *args, object *env) { } else function = eval(function, env); } if (consp(function) && isbuiltin(car(function), LAMBDA)) { - object *result = closure(0, name, function, args, &env); + object *result = closure(0, sym(name), function, args, &env); return eval(result, env); } if (consp(function) && isbuiltin(car(function), CLOSURE)) { function = cdr(function); - object *result = closure(0, name, function, args, &env); + object *result = closure(0, sym(name), function, args, &env); return eval(result, env); } - errorsym(name, PSTR("illegal function"), function); + error(name, PSTR("illegal function"), function); return NULL; } @@ -5477,8 +5477,9 @@ void pradix40 (symbol_t name, pfun_t pfun) { uint32_t x = untwist(name); for (int d=102400000; d>0; d = d/40) { uint32_t j = x/d; - pfun(fromradix40(j)); - x = x - j*d; + char c = fromradix40(j); + if (c == 0) return; + pfun(c); x = x - j*d; } }