In Common Lisp we can exit a function prematurely with specified return value with "return-from". Is there a similar function in PicoLisp?
I've tried googling and ChatGPT to no avail. Interestingly, ChatGPT made up a non-existent "exit" function:
(de my-function (x)
(if (= x 0)
(exit "Early return value") ## Imagined by GPT
(+ x 10) ) )
Something like this would be nice.
A partial answer to this is the quit function, which lets you quit a function prematurely.
Source: https://software-lab.de/doc/refQ.html#quit
(quit ['any ['any]]) Stops current execution. If no arguments are given, all pending finally expressions are executed and control is returned to the top level read-eval-print loop. Otherwise, an error handler is entered. The first argument can be some error message, and the second might be the reason for the error.
HOWEVER, note that quit function doesn't seem to produce a return value.