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 listStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started