// // Course: BU CAS CS 520 // Instructor: Hongwei Xi (hwxi AT cs DOT bu DOT edu) // (* ****** ****** *) fun f91 (x: int): int = if x >= 101 then x - 10 else f91 (f91 (x + 11)) // end of [f91] val () = printf ("f91 (5) = %i\n", @(f91 5)) (* ****** ****** *) // abst@ype ans_t = int typedef ans_t = int typedef cont (a: t@ype) = a -<cloref1> ans_t fun kf91 (x: int, k: cont int): ans_t = if x >= 101 then k (x - 10) else kf91 (x + 11, lam res => kf91 (res, k)) // end of [if] // end of [kf91] val K0 = lam (res: int): ans_t =<cloref1> res val kf91_5 = kf91 (5, K0) val () = printf ("kf91_5 = %i\n", @(kf91_5)) (* ****** ****** *) implement main () = () (* ****** ****** *) (* end of [f91.dats] *)