I worked on Norvig's code to make it generic enough to run in both Python 2 and Python 3. I had also done my own multiline input earlier for the basic lis.py first version and adapted it to run in both environments. I attach those files to this message I linked the thread in Norvig's own site.

Together is also my tail recursive version of factorial, which new lispy.py can optimize as regular loop and therefore manage any debth of recursion. Standard test file is also in zip and runs without errors.

Also I modified lispy.py to take single argument from command line, so you can run for example

lispy factorial.lsp

if you have py added to PATHEXT in Windows, to get print of 5000! by the recursive function.

Here also snapshot of my lis.py multiline prompting with parenthesis counting in action.

Edited 4 Years Ago by pyTony

This question has already been answered. Start a new discussion instead.