// // Course: BU CAS CS 520 // Instructor: Hongwei Xi (hwxi AT cs DOT bu DOT edu) // (* ****** ****** *) fun ack (m: int, n: int): int = if m > 0 then if n > 0 then ack (m-1, ack (m, n-1)) else ack (m-1, 1) else n+1 // end of [ack] (* ****** ****** *) // abst@ype ans_t = int typedef ans_t = int typedef cont (a: t@ype) = a -<cloref1> ans_t fun kack (m: int, n: int, k: cont int): ans_t = if m > 0 then if n > 0 then kack (m, n-1, lam res => kack (m-1, res, k)) else kack (m-1, 1, k) else k (n+1) // end of [kack] val K0 = lam (res: int): ans_t =<cloref1> res val kack_3_3 (*61*) = kack (3, 3, K0) val () = printf ("kack_3_3 (61) = %i\n", @(kack_3_3)) (* ****** ****** *) implement main () = () (* ****** ****** *) (* end of [ack.dats] *)