# CSE 341, ML Minor Assignment

## Due Tuesday, October 7, 9:30 am.

```
```
Submit this assignment electronically - instructions available soon.

You should do the assigment on-line. You can load a file into the ML interpreter with `use("filename");`. Once you have your functions debugged, run them with several test cases to demonstrate that they work. You can record the session with the unix command script. Please edit the resulting typescript to remove the garbage and make it easy for Kevin to grade.

1. What are the values of the following expressions:

1. ` #2("bob", "paul", "susan") `
2. ` tl [2, 3, 4] `
3. ` tl([2, 3, 4]) `
4. ` implode([#"a", #"b", #"c"]) `
5. ` hd (explode("Tom")) `
6. ` tl ("Tom" :: ["Bob", "Mary"]) `

2. What is wrong with each of the following expressions. If possible, suggest an appropriate correction.

1. `#4(3,4,5) `
2. `#2([1,2,3]) `
3. `tl (tl (tl [1, 2])) `
4. `implode(["a", "b", "c"]) `
5. `"Tom" :: ("Bob" :: "Mary") `
6. `[1, "a", #"a"] `

3. Write functions declarations to compute the following.

1. Compute the length of a list (without using the built in `length` function.)
2. Cycle a list once. That is, given the list `[1, 2, 3, 4, 5]`, produce the output ```[2, 3, 4, 5, 1]```.
3. Cycle a list the other way. That is, given the list ```[1, 2, 3, 4, 5]```, produce the output `[5, 1, 2, 3, 4]`.
4. Remove all of the odd numbers from a list of integers.
5. Remove all of the vowels from a string.