Document gotcha with unintended recursion in let

This commit is contained in:
Kodi Arfer 2019-11-12 16:27:07 -05:00
parent f8d3826689
commit cb256fd618

View File

@ -240,7 +240,8 @@ The ``let`` macro takes two parameters: a list defining *variables*
and the *body* which gets executed. *variables* is a vector of
variable and value pairs.
``let`` executes the variable assignments one-by-one, in the order written.
Like the ``let*`` of many other Lisps, ``let`` executes the variable
assignments one-by-one, in the order written::
.. code-block:: hy
@ -249,4 +250,8 @@ variable and value pairs.
... (print x y))
5 6
Unlike them, however, each ``(let …)`` form uses only one
namespace for all its assignments. Thus, ``(let [x 1 x (fn [] x)]
(x))`` returns a function object, not 1 as you might expect.
It is an error to use a let-bound name in a ``global`` or ``nonlocal`` form.