From fedde03f1e6b47784bd2b7d55247e5f2e08a6385 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sat, 20 May 2017 15:46:52 +0200
Subject: Decided: () is our nil/undef
---
ell.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ell.c b/ell.c
index e277d3f..c73ba9e 100755
--- a/ell.c
+++ b/ell.c
@@ -908,8 +908,10 @@ defn (fn_set) {
if ((value = name->next))
return set (ctx, name->value, value);
- // FIXME: how do we represent a nil value here?
- return check (ctx, (*result = new_clone (get (ctx, name->value))));
+ // We return an empty list for a nil value
+ if (!(value = get (ctx, name->value)))
+ return check (ctx, (*result = new_list (NULL)));
+ return check (ctx, (*result = new_clone (value)));
}
defn (fn_list) {
--
cgit v1.2.3-70-g09d2