Norvig's lispy: beautiful and illuminating Python code
- Wicklow Hall 1
- Start (Dublin time):
- Start (your time):
- 180 minutes
if a function? Why does Python need to add keywords from time to time? What precisely is a closure, what problem does it solve, and how does it work? These are some of the fundamental questions you'll be able to answer after this tutorial: an interactive exploration of Peter Norvig's
lis.py–an interpreter for a subset of the Scheme dialect of Lisp in 132 lines of Python.
Peter Norvig of Stanford University wrote
lis.py: an interpreter for a subset of the Scheme dialect of Lisp in 132 lines of readable Python. I took Norvig's code, updated it to modern Python coding style, and integrated it into a Jupyter notebook that provides explanations as well as interactive experiments and exercises checked automatically.
Why should you study lis.py? This is what I got out of it:
Learning how an interpreter works gave me a deeper understanding of Python and programming languages in general—interpreted or compiled.
The simplicity of Scheme is a master class of language design.
lis.pyis a beautiful example of idiomatic Python code.