aboutsummaryrefslogtreecommitdiffstats
path: root/lib/evaluators/Lambda.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-09-18 00:01:08 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-09-18 00:01:08 -0300
commit1d4125dd8ccbe272a190c155a4215daf1f362f10 (patch)
tree60ae213fef5e6c8a552ab7d8601557ede6c9ce43 /lib/evaluators/Lambda.ml
parent24bb5eab738e291ee170f4fd563f39e33f65f37d (diff)
downloadRNT-1d4125dd8ccbe272a190c155a4215daf1f362f10.tar.gz
RNT-1d4125dd8ccbe272a190c155a4215daf1f362f10.zip
fix lambda test and execute
Diffstat (limited to '')
-rw-r--r--lib/evaluators/Lambda.ml8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/evaluators/Lambda.ml b/lib/evaluators/Lambda.ml
index 48ae6ec..a75fc10 100644
--- a/lib/evaluators/Lambda.ml
+++ b/lib/evaluators/Lambda.ml
@@ -77,16 +77,18 @@ let reduce (Program (term, dir)) =
end
| Abstract (binder, body) -> Ok (Closure (binder, body, env))
| Apply (operator, operand) ->
- let* operator = eval env operation in
+ let* operator = eval env operator in
match operator with
| Relation _ -> Error (Error.not_applicable ())
- | _ -> failwith "TODO"
+ | Closure (binder, body, closed) ->
+ let* argument = eval env operand in
+ eval (BatMap.String.add binder argument closed) body
in
eval BatMap.String.empty term
let execute term =
let open Utilities.Result in
- let* value = reduce context term in
+ let* value = reduce term in
match value with
| Closure _ -> Error (Error.unapplied_abstraction ())
| Relation handle ->