From 3d05741bfbf25d0dfd038767737da6f464268e08 Mon Sep 17 00:00:00 2001 From: David Kerkeslager Date: Mon, 31 Aug 2015 22:25:13 -0400 Subject: [PATCH] (define) evaluates definition --- integration_tests/0004_define_evaluates_definition.stt | 4 ++++ integration_tests/0004_define_evaluates_definition.txt | 1 + stutter.py | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 integration_tests/0004_define_evaluates_definition.stt create mode 100644 integration_tests/0004_define_evaluates_definition.txt diff --git a/integration_tests/0004_define_evaluates_definition.stt b/integration_tests/0004_define_evaluates_definition.stt new file mode 100644 index 0000000..17afe15 --- /dev/null +++ b/integration_tests/0004_define_evaluates_definition.stt @@ -0,0 +1,4 @@ +(define hello-world "Hello, world") +(define hello-world-copy hello-world) +(print hello-world-copy) +0 diff --git a/integration_tests/0004_define_evaluates_definition.txt b/integration_tests/0004_define_evaluates_definition.txt new file mode 100644 index 0000000..dbe9dba --- /dev/null +++ b/integration_tests/0004_define_evaluates_definition.txt @@ -0,0 +1 @@ +Hello, world \ No newline at end of file diff --git a/stutter.py b/stutter.py index 7b70dce..c2139e5 100644 --- a/stutter.py +++ b/stutter.py @@ -718,7 +718,7 @@ void define(Environment** parent, Object* args) { assert(countArgs(args) == 2); Object* name = getArg(0, args); - Object* value = getArg(1, args); + Object* value = c_evaluate(parent, getArg(1, args)); assert(name->type == SYMBOL); *parent = makeEnvironmentPointer(name->instance.symbol, value, *parent); -- 2.20.1