File:  [Research Unix] / researchv10no / cmd / sml / doc / examples / SK.sml
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

(* ----- An Interpreter for Call-by-Value SK-calculus ----- *)

datatype Term = S | K | appl of Term * Term;

fun Eval(appl(a,b)) = Apply(appl(Eval a,Eval b)) |
    Eval a = a

and Apply(appl(appl(K,a),b)) = a |
    Apply(appl(appl(appl(S,a),b),c)) = Eval(appl(appl(a,c),appl(b,c))) |
    Apply a = a;

infix *;
fun f * g = appl(f,g);      (* abbreviation for application *)

val I = Eval(S * K *  K);   (* I a = a *)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.