adamc@448: fun add x =
adamc@448: let
adamc@448: fun add' y = x + y
adamc@448: in
adamc@448: add' 1 + add' 2
adamc@448: end
adamc@448:
adamc@448: fun f (x : int) =
adamc@448: let
adamc@448: fun page () = return
adamc@448: {[x]}
adamc@448:
adamc@448: in
adamc@448: page
adamc@448: end
adamc@448:
adamc@448: fun f (x : int) =
adamc@448: let
adamc@448: fun page1 () = return
adamc@448: {[x]}
adamc@448:
adamc@448:
adamc@448: and page2 () =
adamc@448: case Some True of
adamc@448: Some r => return {[r]}
adamc@448: | _ => return Error
adamc@448: in
adamc@450: page2
adamc@450: end
adamc@450:
adamc@450: fun f (x : int) =
adamc@450: let
adamc@450: fun page1 () = return
adamc@450: {[x]}
adamc@450:
adamc@450:
adamc@450: and page2 () =
adamc@450: case Some True of
adamc@450: Some r => return {[r]}
adamc@450: | _ => return !!
adamc@450:
adamc@450: and page3 () = return !!
adamc@450: !
adamc@450: in
adamc@450: page3
adamc@448: end
adamc@448:
adamc@453: fun add2 (x : int) (y : int) =
adamc@453: let
adamc@453: fun add3 () = x + y
adamc@453: in
adamc@453: add3
adamc@453: end
adamc@453:
adamc@453: fun add3 (x : int) =
adamc@453: let
adamc@453: fun add2 (y : int) =
adamc@453: let
adamc@453: fun add1 (z : int) = x + y + z
adamc@453: in
adamc@453: add1
adamc@453: end
adamc@453: in
adamc@453: add2
adamc@453: end
adamc@453:
adamc@453: (*datatype list t = Nil | Cons of t * list t
adamc@448:
adamc@448: fun length (t ::: Type) (ls : list t) =
adamc@448: let
adamc@448: fun length' ls acc =
adamc@448: case ls of
adamc@448: Nil => acc
adamc@448: | Cons (_, ls') => length' ls' (acc + 1)
adamc@448: in
adamc@448: length' ls 0
adamc@448: end
adamc@450:
adamc@453: *)