Idorobots / spartan

A small Lisp dialect that serves me as a test bed for programming language features.
MIT License
13 stars 3 forks source link

Letrec conversion test fails when run on its own #200

Closed Idorobots closed 1 week ago

Idorobots commented 2 months ago

Result when running just letrec conversion:

- converts more complex recursive functions correctly - !!!FAILURE!!!
(run (quote (letrec ((lazy-23 (cons 23 (lambda () lazy-23))) (lazy-take (lambda (list n) (if (zero? n) (quote ()) (cons (car list) (lazy-take ((cdr list)) (- n 1)))))) (bar (lazy-take lazy-23 5))) bar))) did not satisfy #<procedure:equal?>
expected:
(23 23 23 23 23)
received:
#(struct:resumable #(struct:closure () #<procedure>) (23 23 23 23 23))

The test case passes when run with another test case that runs some code (for instance Recursion). Likely due to the continuation short-circuiting optimization.