Using sml to code Here is a small exercise to get you working with trees. Make a le, P2.sml, and place in it this de nition of IntTree: IntTree = Leaf | Node of int * IntTree * IntTree Now, code this...


Using sml to code
Here is a small exercise to get you working with trees. Make a  le, P2.sml, and place in it this de nition of
IntTree: IntTree = Leaf | Node of int * IntTree * IntTree
Now, code this function, using any of the functions you have encountered so far on lists and trees:
(* sumInts : IntTree -> int
adds up all the ints contained in InTree t and returns the total.
Examples: sumInts (Node(3, Node(2, Leaf, Node(4, Leaf, Leaf)), Leaf)) = 9
sumInts (Leaf) = 0 *)
Test your function on the two test cases listed above. Copy and paste your output



Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here