Question 24 Translate the following code so that only tail function calls are made using continuation passing. If you use a language that is not ML, please indicate which language. fun insert(x, nil) = [x] | insert(x, y1::y2) = if (x = y1) then y1:y2 else y1:insert(x, y2); fun process(x,y) = if (x > 100) then 100 :: process(x-100,y) else insert(x,y); Edit View Insert Format Tools Table | B IU A v 2v T²v: 12pt v Paragraph v
Question 24 Translate the following code so that only tail function calls are made using continuation passing. If you use a language that is not ML, please indicate which language. fun insert(x, nil) = [x] | insert(x, y1::y2) = if (x = y1) then y1:y2 else y1:insert(x, y2); fun process(x,y) = if (x > 100) then 100 :: process(x-100,y) else insert(x,y); Edit View Insert Format Tools Table | B IU A v 2v T²v: 12pt v Paragraph v
Related questions
Question
![Question 24
Translate the following code so that only tail function calls are made using continuation passing. If
you use a language that is not ML, please indicate which language.
fun insert(x, nil) = [x]
| insert(x, y1::y2) = if (x = y1) then y1:y2 else y1:insert(x, y2);
fun process(x,y) = if (x > 100) then 100 :: process(x-100,y) else insert(x,y);
Edit View Insert Format Tools Table
|
B IU A
v 2v T²v:
12pt v Paragraph v](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb4c78b0a-a2c2-486f-8f65-ff1931181065%2F2bcdee09-8b44-496c-86a9-2f1d2a5a485c%2Fmmdqny_processed.png&w=3840&q=75)
Transcribed Image Text:Question 24
Translate the following code so that only tail function calls are made using continuation passing. If
you use a language that is not ML, please indicate which language.
fun insert(x, nil) = [x]
| insert(x, y1::y2) = if (x = y1) then y1:y2 else y1:insert(x, y2);
fun process(x,y) = if (x > 100) then 100 :: process(x-100,y) else insert(x,y);
Edit View Insert Format Tools Table
|
B IU A
v 2v T²v:
12pt v Paragraph v
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
