Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /archive/0.93/doc/examples/spread/tree.sml
ViewVC logotype

View of /archive/0.93/doc/examples/spread/tree.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 4958 - (download) (annotate)
Wed Apr 10 01:33:29 2019 UTC (3 months, 1 week ago) by dbm
File size: 419 byte(s)
adding 0.93 src and doc to archive
structure Tree : FORMULA =
    datatype formula = NUM of int 
		     | CELLREF of formula * formula
		     | BINOP of (int*int->int) * formula * formula
		     | IF of formula * formula * formula
   fun eval f a =
     let fun g  (NUM i) = i
           | g (CELLREF(x,y)) = a sub (g x)  sub (g y)
	   | g (BINOP(p,x,y)) = p(g x, g y)
	   | g (IF(x,y,z)) = if g x <> 0 then g y else g z
      in g f

ViewVC Help
Powered by ViewVC 1.0.0