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!)

Please answer using this language: Standard ML (SML) Answer will receive downvote

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!