Decided: () is our nil/undef

This commit is contained in:
Přemysl Eric Janouch 2017-05-20 15:46:52 +02:00
parent 23da396614
commit fedde03f1e
Signed by: p
GPG Key ID: B715679E3A361BE6
1 changed files with 4 additions and 2 deletions

6
ell.c
View File

@ -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) {