In both Emacs Lisp and Common Lisp, the following returns nil
(let (x y z)
x)
yet in every Scheme that I've tried, it throws an error.
Has the above been acceptable under any Scheme standard?
In both Emacs Lisp and Common Lisp, the following returns nil
(let (x y z)
x)
yet in every Scheme that I've tried, it throws an error.
Has the above been acceptable under any Scheme standard?
amalloy
On
"Any version of Scheme ever" is a very broad brush, and it could take some research to rule out all of history. But in the modern Schemes I know, it is not allowed, and the R5RS standard clearly does not allow it, by specifying that the bindings for a let must come in name/value pairs, and not specifying what a name without a value would mean.
Copyright © 2021 Jogjafile Inc.
No, the posted code was never legal in standard Scheme. For all Scheme standards since R1RS (1978)
lethas had the syntax:(let ((var1 form1) ...) expr1 expr2 ...). The original Scheme paper by Sussman and Steele (1975) did not even uselet.Note that, e.g.,
(let () 42)is legal in both Scheme and in Common Lisp, i.e., it is legal to have aletform with no bindings.