Annotation of researchv10no/cmd/sml/doc/examples/spread/tree.sml, revision 1.1

1.1     ! root        1: structure Tree : FORMULA =
        !             2: struct
        !             3:     datatype formula = NUM of int 
        !             4:                     | CELLREF of formula * formula
        !             5:                     | BINOP of (int*int->int) * formula * formula
        !             6:                     | IF of formula * formula * formula
        !             7:    fun eval f a =
        !             8:      let fun g  (NUM i) = i
        !             9:            | g (CELLREF(x,y)) = a sub (g x)  sub (g y)
        !            10:           | g (BINOP(p,x,y)) = p(g x, g y)
        !            11:           | g (IF(x,y,z)) = if g x <> 0 then g y else g z
        !            12:       in g f
        !            13:      end
        !            14: end

unix.superglobalmegacorp.com

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