lithp.py

It wasn't enough to write the Lisp interpreter -- I also wanted to share what I learned with you. Reading
this source code provides a snapshot into the mind of John McCarthy, Steve Russell, Timothy P. Hart, and Mike Levin and
as an added bonus, myself. The following source files are available for your reading:

defprint_help(self):print"Help for Lithp v",VERSIONprint" Type :help for more information"print" Type :env to see the bindings in the current environment"print" Type :load followed by one or more filenames to load source files"print" Type :quit to exit the interpreter"

In the process of living my life I had always heard that closures and dynamic scope
cannot co-exist. As a thought-experiment I can visualize why this is the case. That is,
while a closure captures the contextual binding of a variable, lookups in dynamic scoping
occur on the dynamic stack. This means that you may be able to close over a variable as
long as it's unique, but the moment someone else defines a variable of the same name
and attempt to look up the closed variable will resolve to the top-most binding on the
dynamic stack. This assumes the the lookup occurs before the variable of the same name
is popped. While this is conceptually easy to grasp, I still wanted to see what would
happen in practice -- and it wasn't pretty.