Question: Exercises 3.30 ML and Haskell do not have general list structures like Scheme, but require the elements in a list to have all the same

 Exercises 3.30 ML and Haskell do not have general list structures

Exercises 3.30 ML and Haskell do not have general list structures like Scheme, but require the elements in a list to have all the same data type. Why is this? What data structure in an imperative language do such lists imitate? Write a Scheme program to show that the Scheme procedures force and de l ay actually use pass by need memoization. (a) 3.31 3.32 Write a sieve of Eratosthenes in Scheme or ML using generators and filters, similar to the Haskell version in Section 3.5 (b) Rewrite the Scheme version to use f or ce and de l ay Rewrite the Scheme intlist function in Section 3.4 so that it takes only a lower bound as a parameter and produces a stream of integers from that point on: ( i nt l i st .33 5) ( 5 6 7 Haskell list comprehensions are actually compact expressions for generator-filter programs as noted in the text. For example, the list comprehension 34 is equivalent to a generator procedure that produces the stream of integers beginning with 2 (represented by { 2) and sends its output to the selector procedure of the predicate mod n 2 # () that passes on the list whose elements satisfy the predicate. Write a Scheme procedure that Exercises 3.30 ML and Haskell do not have general list structures like Scheme, but require the elements in a list to have all the same data type. Why is this? What data structure in an imperative language do such lists imitate? Write a Scheme program to show that the Scheme procedures force and de l ay actually use pass by need memoization. (a) 3.31 3.32 Write a sieve of Eratosthenes in Scheme or ML using generators and filters, similar to the Haskell version in Section 3.5 (b) Rewrite the Scheme version to use f or ce and de l ay Rewrite the Scheme intlist function in Section 3.4 so that it takes only a lower bound as a parameter and produces a stream of integers from that point on: ( i nt l i st .33 5) ( 5 6 7 Haskell list comprehensions are actually compact expressions for generator-filter programs as noted in the text. For example, the list comprehension 34 is equivalent to a generator procedure that produces the stream of integers beginning with 2 (represented by { 2) and sends its output to the selector procedure of the predicate mod n 2 # () that passes on the list whose elements satisfy the predicate. Write a Scheme procedure that

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!