In Common Lisp, we have to use the let
form to declare a new lexically-scoped variable. This means that the code either looks like that written in C89 (all variables declared on top of scope), or acquires unreadably deep nesting. let*
is somewhat useful, but is not always applicable.
Scheme 'solves' this problem by having a define
form, that allows a lexical variable to be declared without creating a new nesting level.
So, the question is, is it possible to have Scheme-like variable declarations in Common Lisp, that do not increase the nesting level?
destructuring-bind
. Unfortunately, I am not a Common Lisp expert and cannot evaluate the quality of that answer - but maybe you try this by yourself?destructuring-bind
is used to declare a bunch of variables whose values are members of a list (kind of like pattern matching).