(module Env2 in prelude out everything) (data (Tree a) (#leaf) (#node Int a (Tree a) (Tree a))) (data (Result a) (#found a) (#notFound)) {- Basic boolean support -} (fun and Bool (x Bool y Bool) (if x y x)) (fun not Bool (x Bool) (if x False True)) {- Equality on integers -} (fun eq Bool (x Int y Int) (@and (<= x y) (<= y x))) (fun insert (Tree a) (key Int val a tree3 (Tree a)) (#leaf)) {- (if (?leaf tree3) (#leaf) (#leaf))) -} (fun plus Int (x Int) (+ x 5)) (global tom Int (@plus 1)) (global t1 (Tree Char) (@insert 3 'z' (#leaf))) (global xx Int 12) (global t2 Int (block (write "BAD") xx)) (global mytree (Tree Char) (# node 1 'a' (#leaf) (#leaf) ) ) main 0