commit 7a20c9c7545bb24e71ece3e9530b92a013045091
parent b484f12d9d245e1a3603d9baa50b37a59697b886
Author: Ed van Bruggen <edvb@uw.edu>
Date: Wed, 28 Mar 2018 18:43:28 -0700
Allow for lambdas with no arguments
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tisp.c b/tisp.c
@@ -607,7 +607,7 @@ prim_cond(Hash env, Val args)
static Val
prim_lambda(Hash env, Val args)
{
- if (list_len(args) < 2 || car(args)->t != PAIR)
+ if (list_len(args) < 2 || (car(args)->t != PAIR && !nilp(car(args))))
warn("lambda: incorrect format");
return mk_func(car(args), car(cdr(args)), env);
}