I use uLisp version 3.0a on an M5Stack (ESP32). To refresh my Lisp knowledge I’m hanging around with the book “Structure and Interpretation of Computer Programs”. One example leads to a core crash:
(defun sum (term a next b) (if (> a b) 0 (+ (term a) (sum term (next a) next b)))) (defun cubic (x) (* x x x)) (defun inc (n) (+ n 1)) (defun cubic-sum (a b) (sum cubic a inc b))
The cubic sum from 1 to 10 is calculated correctly:
7894> (cubic-sum 1 10)
Even from 1 to 100 it works as expected:
7894> (cubic-sum 1 100)
But with higher values a core crash occurs:
7920> (cubic-sum 1 200)
Guru Meditation Error: Core 1 panic’ed (Unhandled debug exception)
Debug exception reason: Stack canary watchpoint triggered (loopTask)
I have tried the square sum instead of the cubic sum, but the error occurs identically. I have also recursively calculated the faculty of large numbers without causing such an error.
What could that be?