technoblogy / ulisp-esp

A version of the Lisp programming language for ESP32-based boards.
MIT License
106 stars 37 forks source link

Value from return is evaluated an extra time #79

Closed technoblogy closed 3 months ago

technoblogy commented 11 months ago

The value returned by return is incorrectly evaluated an extra time if the return clause is not the last expression within a progn and is within a loop, dotimes, or dolist block.

Expected:

21808> (let ((a 7)) (loop (progn (return 'a))))
a

Observed:

21808> (let ((a 7)) (loop (progn (return 'a) nil)))
7

Will be fixed next release.

dragoncoder047 commented 9 months ago

What exactly is the "fix" you have? I don't see this problem in my fork (as of f5dc52a47161a4ab3370d53b589a02280315c063). I get the expected output:

{GC#1:50,8977/9044}[Ready.]
(let ((a 7)) (loop (progn (return 'a))))
a
technoblogy commented 9 months ago

My issue report is badly worded. the test to try is:

(let ((a 7)) (loop (progn (return 'a) nil)))

Correct answer 'a', wrong answer '7'.

technoblogy commented 3 months ago

This is fixed in Version 4.6.