diff --git a/src/eval.c b/src/eval.c index daeef8b..eaf3c8f 100644 --- a/src/eval.c +++ b/src/eval.c @@ -167,7 +167,7 @@ static void init_special_form_handlers(void) /* HANDLER("letrec", &letrec_special_form); */ } -static gboolean is_special_form(LakeList *expr) +gboolean is_special_form(LakeList *expr) { if (special_form_handlers == NULL) { init_special_form_handlers(); diff --git a/src/eval.h b/src/eval.h index 46d29a2..0dce2a1 100644 --- a/src/eval.h +++ b/src/eval.h @@ -16,5 +16,6 @@ LakeVal *eval(Env *env, LakeVal *expr); LakeList *eval_exprs(Env *env, LakeList *exprs); LakeVal *apply(LakeVal *fnVal, LakeList *args); +gboolean is_special_form(LakeList *expr); #endif \ No newline at end of file diff --git a/src/lake.c b/src/lake.c index 274e305..07d7f8f 100644 --- a/src/lake.c +++ b/src/lake.c @@ -78,8 +78,9 @@ static LakeVal *prompt_read(Env *env, char *prompt) LakeVal *result; /* naked call */ - LakeVal *head = eval(env, LIST_VAL(list, 0)); - if (LIST_N(list) > 1 && CALLABLE(head)) { + LakeVal *head; + if (is_special_form(list) || + (LIST_N(list) > 1 && (head = eval(env, LIST_VAL(list, 0))) && CALLABLE(head))) { result = VAL(list); }