mirror of
https://github.com/samsonjs/lake.git
synced 2026-03-25 08:55:49 +00:00
allow naked special forms
This commit is contained in:
parent
cb7b786ffd
commit
2efdbae78a
3 changed files with 5 additions and 3 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue