|
|
1.1 ! root 1: (* ----- An Interpreter for Call-by-Value SK-calculus ----- *) ! 2: ! 3: datatype Term = S | K | appl of Term * Term; ! 4: ! 5: fun Eval(appl(a,b)) = Apply(appl(Eval a,Eval b)) | ! 6: Eval a = a ! 7: ! 8: and Apply(appl(appl(K,a),b)) = a | ! 9: Apply(appl(appl(appl(S,a),b),c)) = Eval(appl(appl(a,c),appl(b,c))) | ! 10: Apply a = a; ! 11: ! 12: infix *; ! 13: fun f * g = appl(f,g); (* abbreviation for application *) ! 14: ! 15: val I = Eval(S * K * K); (* I a = a *)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.