X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=code%2Fski_evaluator.ml;h=11e8dd4ebd85a4794317052a7c39f8eaa3387eb6;hp=7837880365057978397f4678c542773f114708af;hb=0cb89c90973c0c5c74d7c3cfd929ca95946d44e4;hpb=9b34e7223f28c82ed4fb600c44a7fbfe5d72a88a diff --git a/code/ski_evaluator.ml b/code/ski_evaluator.ml index 78378803..11e8dd4e 100644 --- a/code/ski_evaluator.ml +++ b/code/ski_evaluator.ml @@ -42,7 +42,7 @@ let rec reduce_try3 (t:term):term = match t with type to emphasize the parallels with the untyped interpreter. *) type reduceOutcome = AlreadyReduced | ReducedTo of term - let reduce_if_redex (t : term) : term = match t with + let reduce_if_redex (t : term) : reduceOutcome = match t with | App(I,a) -> ReducedTo a | App(App(K,a),b) -> ReducedTo a | App(App(App(S,a),b),c) -> ReducedTo (App(App(a,c),App(b,c))) @@ -64,7 +64,7 @@ let rec reduce_try3 (t:term):term = match t with type reduceOutcome = AlreadyReduced | ReducedTo of term - let rec reduce_once (t : term) : term = match t with + let rec reduce_once (t : term) : reduceOutcome = match t with | App(a, b) -> (match reduce_once a with | ReducedTo a' -> ReducedTo (App(a',b)) | AlreadyReduced -> (match reduce_once b with @@ -96,7 +96,7 @@ let rec reduce_try3 (t:term):term = match t with | App(App(App(S,_),_),_) -> true | _ -> false - let rec reduce_head_once (t : term) : term = match t with + let rec reduce_head_once (t : term) : reduceOutcome = match t with | App(a, b) -> (match reduce_head_once a with | ReducedTo a' -> ReducedTo (App(a',b)) (* now we only try to reduce b when App(a,b) is a redex *)