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

Fill-in the 3 blank areas of code for the below ML recursive function named rws that takes a string and return a new string with all whitespace removed.
fun rws =
if s=" then ""
else if hd (explode s)= #"" then
else implode(
hd (explode s) :: explode ()
;
Hint: this code uses two ML higher-order 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 *)
 Fill-in the 3 blank areas of code for the below ML

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!