Demo: Fibonacci
Code: Select all
$ ./ChessLisp
ChessLisp ready
[] (defun fib (n) (cond ((= n 0) 1) ((= n 1) 1) (t (+ (fib (- n 1)) (fib (- n 2))))))
fib
[] (fib 40)
165580141
[] (quit)
nil
$
Moderator: Ras
Code: Select all
$ ./ChessLisp
ChessLisp ready
[] (defun fib (n) (cond ((= n 0) 1) ((= n 1) 1) (t (+ (fib (- n 1)) (fib (- n 2))))))
fib
[] (fib 40)
165580141
[] (quit)
nil
$
Is there any version of this available to the public?sje wrote:ChessLisp's user function invocation is now working. However, the internal evaluator implementation needs to be changed from recursive to iterative. But all the dynamic and lexical scope bindings are working along with the activation stack and storage reclamation, so that's something.
Demo: FibonacciCode: Select all
$ ./ChessLisp ChessLisp ready [] (defun fib (n) (cond ((= n 0) 1) ((= n 1) 1) (t (+ (fib (- n 1)) (fib (- n 2)))))) fib [] (fib 40) 165580141 [] (quit) nil $