Question: Please answer using this language: Standard ML (SML) Answer will receive downvote if written in the wrong language, and I will probably cry. Part A
Please answer using this language: Standard ML (SML)
Answer will receive downvote if written in the wrong language, and I will probably cry.
Part A
Write a datatype definition for a type 'number' whose values are either integers or real numbers
Part B
Using your definition from Part A, write a function 'plus' of type 'number' -> 'number' -> 'number' that adds two numbers, coercing int to real only if necessary.
Part C
Write a function 'addup' of type 'intnest' -> 'int' that adds up all the integers in an 'intnest'. Use this definition for 'intnest'. (be careful as you type. INT is not the same as int!)

Thank you very much!
datatype intnest INT of intl LIST of intnest list; datatype intnest INT of intl LIST of intnest list
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
