Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created November 3, 2019 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chelseatroy/b3b428811d7c05600bd52b6f95ddb743 to your computer and use it in GitHub Desktop.
Save chelseatroy/b3b428811d7c05600bd52b6f95ddb743 to your computer and use it in GitHub Desktop.
Interpreter 1: No Scope (excerpt)
def substitute(exp, name, value):
if exp == name:
return value
elif isinstance(exp, tuple):
return tuple([substitute(part, name, value) for part in exp])
else:
return exp #Unchanged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment