3 ms·
Yeah, to be honest I'm too out of this context to speak of deep technicalities, but a quick test seems to indicate that Dusk's comp/lisp can do something simila
by vdupras 2y ago
Yeah, to be honest I'm too out of this context to speak of deep technicalities, but a quick test seems to indicate that Dusk's comp/lisp can do something similar to your first example, unless I misunderstood it:
$ make run
stty -icanon -echo min 0; ./dusk ; stty icanon echo
Dusk OS
79KB used 31MB free ok
needs comp/lisp
ok
lisp (defun make-adder (x) (lambda (y) (+ x y)))
ok
lisp (defun x+3 (x) ((make-adder 3) x))
ok
lisp (defun x+7 (x) ((make-adder 7) x))
ok
lisp. (x+3 7)
10 ok
lisp. (x+7 8)
15 ok
- kragen 2y agoThat could work without upward funargs because, in your version, (make-adder 3) and (make-adder 7) aren't live at the same time, so they might be using the same "x" instead of two separate "x" bindings. My hunch is that that "x" is in memory space that would be overwritten if you called another largish function in between calling make-adder and invoking its return value, but I haven't grokked comp/lisp fully enough to be sure that that's true.