McGill University COMP 302 (* PRELUDE *) type nat = Z | S of nat type exp = | Const of float | Var | Plus of exp * exp | Times of exp * exp | Pow of exp * int (* SOLUTION *) (* Quesiton 1 *) let rec q1a_nat_of_int (n : int) : nat = match n with | 0 -> Z | _ -> S (q1a_nat_of_int (n-1)) let rec q1b_int_of_nat (n : nat) : int = match n with | Z -> 0 | S n -> 1 + q1b_int_of_nat n ...[Show More]
Category: | Solutions Manual |
Number of pages: | 2 |
Language: | English |
Last updated: | 1 year ago |
Downloads: | 1 |
Views: | 0 |