summaryrefslogtreecommitdiff
path: root/src/library.c
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-09-27 19:39:13 -0400
committerLLLL Colonq <llll@colonq>2025-09-27 19:39:13 -0400
commitf712d031f0406c84d2ee8addfa53e6522d146104 (patch)
tree2114d9d69a3c8e593a740e95a14b34849f98536a /src/library.c
parentab57bc2a6d6ea9c24aa119df6efbd8a38b54c312 (diff)
Fix bug related to nested evaluation
Diffstat (limited to 'src/library.c')
-rw-r--r--src/library.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/library.c b/src/library.c
index be38292..9aaadc3 100644
--- a/src/library.c
+++ b/src/library.c
@@ -130,7 +130,15 @@ static pit_value impl_symbol_is_macro(pit_runtime *rt, pit_value args) {
static pit_value impl_funcall(pit_runtime *rt, pit_value args) {
pit_value fsym = pit_car(rt, args);
- pit_value f = pit_fget(rt, fsym);
+ pit_value f;
+ if (pit_is_symbol(rt, fsym)) {
+ f = pit_fget(rt, fsym);
+ } else {
+ // if f is not a symbol, assume it is a func or nativefunc
+ // most commonly, this happens when you funcall a variable
+ // with a function in the value cell, e.g. passing a lambda to a function
+ f = fsym;
+ }
pit_value as = pit_cdr(rt, args);
return pit_apply(rt, f, as);
}