Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program in SML (standard ML) You can use the following functions from the SML Basis Library, but not any others. http://sml-family.org/Basis/top-level-chapter.html http://sml-family.org/Basis/list.html http://sml-family.org/Basis/list-pair.html 3. (i)

Program in SML (standard ML)image text in transcribed

You can use the following functions from the SML Basis Library, but not any others.

http://sml-family.org/Basis/top-level-chapter.html http://sml-family.org/Basis/list.html http://sml-family.org/Basis/list-pair.html

3. (i) Code a function follows ('a *'a ->bool) -> 'a listbool that returns true if and only if every pair of consecutive elements in the given list is in the given relation. (Notice that, if the given list is of length less than 2, this is trivially the case.) - follows op [1,3,2,8,3]; val it true; follows op [1,3,2,2,3]; val it false; -follows ops [1,2, 17, 235]; val it - follows op bool that checks if the given list of value and integer pairs is a valid compression, i.e., that, (a) in each such pair, the number component is non-0 (and also non-negative), and (b) in each two consecutive such pairs, the values components are different. - validCompr [(17, 3), (42, 5), (1011, 2)]; val it = true - validCompr [(17, 3), (2018, 0), (42, 5), (1011, 2)]; val it-false - validCompr [(17, 3), (42, 2), (42, 3), (1011, 2)]; val it false 3. (i) Code a function follows ('a *'a ->bool) -> 'a listbool that returns true if and only if every pair of consecutive elements in the given list is in the given relation. (Notice that, if the given list is of length less than 2, this is trivially the case.) - follows op [1,3,2,8,3]; val it true; follows op [1,3,2,2,3]; val it false; -follows ops [1,2, 17, 235]; val it - follows op bool that checks if the given list of value and integer pairs is a valid compression, i.e., that, (a) in each such pair, the number component is non-0 (and also non-negative), and (b) in each two consecutive such pairs, the values components are different. - validCompr [(17, 3), (42, 5), (1011, 2)]; val it = true - validCompr [(17, 3), (2018, 0), (42, 5), (1011, 2)]; val it-false - validCompr [(17, 3), (42, 2), (42, 3), (1011, 2)]; val it false

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Compose the six common types of social business messages.

Answered: 1 week ago

Question

Describe positive and neutral messages.

Answered: 1 week ago