Earlier quoted context omitted.
I have TinyScheme running on a STM32F415. https://sc4.us/hsm/
Any BSD kernel drivers for this?
uLisp – Lisp for the Arduino
31–34 of 34 posts
Re: uLisp – Lisp for the Arduino
#32Earlier quoted context omitted.
I have TinyScheme running on a STM32F415. https://sc4.us/hsm/
I love TinyScheme. I love NaCl. This is wonderful!
Re: uLisp – Lisp for the Arduino
#33Though uLisp has tail-call optimization, if the C compiler doesn't, then the garbage collector needs stack in proportion to list length: void markobject (object *obj) { if (obj == NULL) return; object* arg = car(obj); if (marked(obj)) return; int type = obj->type; mark(obj); if (type != SYMBOL && type != NUMBER) { // cons markobject(arg); markobject(cdr(obj)); // It's simple enough to obj = cdr(obj) and wrap a loop a…
Re: uLisp – Lisp for the Arduino
#34Though uLisp has tail-call optimization, if the C compiler doesn't, then the garbage collector needs stack in proportion to list length: void markobject (object *obj) { if (obj == NULL) return; object* arg = car(obj); if (marked(obj)) return; int type = obj->type; mark(obj); if (type != SYMBOL && type != NUMBER) { // cons markobject(arg); markobject(cdr(obj)); // It's simple enough to obj = cdr(obj) and wrap a loop a…
That's why I wrote "in proportion to list length", not "tree structure depth" in general.
Above, we still have recursion when marking the arg = car(obj) value. However, Lisp lists tend to be greatly unbalanced in favor of growing in the cdr direction; that is why it helps to iterate on the cdr.