summaryrefslogtreecommitdiff
path: root/src/runtime.c
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-12-19 21:31:02 -0500
committerLLLL Colonq <llll@colonq>2025-12-19 21:31:02 -0500
commit0a6ce352be7d0a8a2cdb2f9a3ae3b0189c5f23b5 (patch)
treedc79bf6249ba90a384794954c1a06568a9ef6aa8 /src/runtime.c
parent2dfa52e475fbc5614f92cfbc42d5b25fc5b8eff2 (diff)
Add pit_plist_get
Diffstat (limited to 'src/runtime.c')
-rw-r--r--src/runtime.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/runtime.c b/src/runtime.c
index fcfe81a..86c5fea 100644
--- a/src/runtime.c
+++ b/src/runtime.c
@@ -701,6 +701,15 @@ pit_value pit_contains_eq(pit_runtime *rt, pit_value needle, pit_value haystack)
}
return PIT_NIL;
}
+pit_value pit_plist_get(pit_runtime *rt, pit_value k, pit_value vs) {
+ while (vs != PIT_NIL) {
+ if (pit_eq(k, pit_car(rt, vs))) {
+ return pit_car(rt, pit_cdr(rt, vs));
+ }
+ vs = pit_cdr(rt, vs);
+ }
+ return PIT_NIL;
+}
pit_value pit_free_vars(pit_runtime *rt, pit_value bound, pit_value body) {
i64 expr_stack_reset = rt->expr_stack->top;