mirror of
https://github.com/samsonjs/lake.git
synced 2026-04-27 14:57:43 +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); */
|
/* HANDLER("letrec", &letrec_special_form); */
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean is_special_form(LakeList *expr)
|
gboolean is_special_form(LakeList *expr)
|
||||||
{
|
{
|
||||||
if (special_form_handlers == NULL) {
|
if (special_form_handlers == NULL) {
|
||||||
init_special_form_handlers();
|
init_special_form_handlers();
|
||||||
|
|
|
||||||
|
|
@ -16,5 +16,6 @@
|
||||||
LakeVal *eval(Env *env, LakeVal *expr);
|
LakeVal *eval(Env *env, LakeVal *expr);
|
||||||
LakeList *eval_exprs(Env *env, LakeList *exprs);
|
LakeList *eval_exprs(Env *env, LakeList *exprs);
|
||||||
LakeVal *apply(LakeVal *fnVal, LakeList *args);
|
LakeVal *apply(LakeVal *fnVal, LakeList *args);
|
||||||
|
gboolean is_special_form(LakeList *expr);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -78,8 +78,9 @@ static LakeVal *prompt_read(Env *env, char *prompt)
|
||||||
LakeVal *result;
|
LakeVal *result;
|
||||||
|
|
||||||
/* naked call */
|
/* naked call */
|
||||||
LakeVal *head = eval(env, LIST_VAL(list, 0));
|
LakeVal *head;
|
||||||
if (LIST_N(list) > 1 && CALLABLE(head)) {
|
if (is_special_form(list) ||
|
||||||
|
(LIST_N(list) > 1 && (head = eval(env, LIST_VAL(list, 0))) && CALLABLE(head))) {
|
||||||
result = VAL(list);
|
result = VAL(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue