Created
September 27, 2016 01:47
-
-
Save milesrout/e88592422e71183547622a4e87ee7170 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Env(BaseEnv): | |
def __init__(self, bindings=None): | |
super().__init__({ | |
# syntactic forms | |
'let': syntaxLet, | |
'lambda': syntaxLambda, | |
'quote': syntaxQuote, | |
'exact-number': syntaxExact, | |
'inexact-number': syntaxInexact, | |
'set!': syntaxSetBang, | |
'if': syntaxIf, | |
# primitive functions | |
'list': primList, | |
'+': primPlus, | |
'-': primMinus, | |
'*': primTimes, | |
'/': primDivide, | |
'car': evaluate(read("(lambda ((x . y)) x)"), BaseEnv({ 'lambda': syntaxLambda })), | |
'cdr': evaluate(read("(lambda ((x . y)) y)"), BaseEnv({ 'lambda': syntaxLambda })), | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment