diff options
| author | mryouse | 2022-05-24 03:36:08 +0000 |
|---|---|---|
| committer | mryouse | 2022-05-24 03:36:08 +0000 |
| commit | 57c14ee840872853fe3a7ba3141bab5f7a60e6ce (patch) | |
| tree | 45828b5bcd23266d81a53064bf1a45a401a5c902 | |
| parent | c8f500bd280068900273281cf267f76447b6a554 (diff) | |
return empty lists as-is
| -rw-r--r-- | interpreter.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/interpreter.py b/interpreter.py index 576af47..09f298b 100644 --- a/interpreter.py +++ b/interpreter.py @@ -101,6 +101,9 @@ def evaluate(expr, env): # if it's a literal list, return it if expr.data: return expr + # if it's an empty list, return it + elif len(expr.args) == 0: + return expr if not isinstance(expr.args[0], Symbol): raise Exception("can't evaluate without a symbol") |
