Question: Fill - in the 3 blank areas of code for the below ML recursive function named r w s that takes a string and return
Fillin the blank areas of code for the below ML recursive function named that takes a string and return a new string with all whitespace removed.
fun rws
if then
else if hd explode s # then
else implode
hd explode s :: explode
;
Hint: this code uses two ML higherorder functions:
explode takes a string and returns a list of characters
implode takes a list of characters and returns a string
You can test your program with the following two test data:
rws "blah foo bar"; result should be: val it "blahfoobar": string; result should be: val it "multiplespaces": string; result should return the same string
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
