Closed lambdageek closed 5 years ago
Note that this is going to be slightly non-trivial.
Fortunately you're in Haskell, so you can use a knot tying trick to make a bunch of closures that all reference the environment that would exist after all of them are added to it. This will probably require scanning through the begin form to find all the definitions that precede the final expression to be evaluated. (This section 1.2.3.7 from the Racket Reference might be useful - or possibly confusing - I'm not sure.)
thanks for raising issues, you really are @lambdageek ! :)
For any solutions, there must be balance between correctness for the sake of implementing Scheme standards, and simplicity to satisfy the tutorials purpose of teaching programming language development. Currently, our solution gets most of Scheme lexical scoping using an incredibly simple mechanism: the local function of ReaderT and local
. I believe, the solution must satisfy simplicity for the sake of the narrative, and any proposed solutions should be considerate of this goal.
Since mutual recursion is supported under the current implementation of the project, I'm going to close this issue. I've referenced this issue in Issue #23 , which should be the stub for any further work on this topic.
Once #23 is fixed, you'll find that the following will not work:
Returns
Unbound variable: odd
rather than the expected#f
Update: Actually once #23 and #25 are fixed, you'll find that even singly-recursive functions (such as
foldl
from the stdlib) will not work. Just trying to get factorial working is worth thinking about.