Description
This one is super easy because you have a final exam the day after this is due, there’s no separate final exam week, and we’re just plain running out of time.
For each of the following problems, provide a pattern-matching solution in Erlang. Do not resort to just giving a new name to an existing Erlang function that already does what we want your function to do. Submit your solutions as a single file named “hw5.erl”. Don’t forget to declare the module name and the functions to be exported at the top of the file.
And now, here are your last homework problems:
- myremoveduplicates
myremoveduplicates(“abacad”) => “bcad” myremoveduplicates([3,2,1,3,2,2,1,1]) => [3,2,1]
- myintersection
myintersection(“abc”, “bcd”) => “bc” myintersection([3,4,2,1], [5,4,1,6,2]) => [4,2,1] myintersection([], [1,2,3]) => [] myintersection(“abc”, “”) => “”
- mylast mylast(“”) => “” mylast(“b”) => “b” mylast(“abcd”) => “d” mylast([1,2,3,4]) => [4] mylast([]) => []
- myreverse
myreverse(“”) => “” myreverse(“abc”) => “cba” myreverse([1,2,3]) => [3,2,1] myreverse([]) => []
- myreplaceall
myreplaceall(3,7,[7,0,7,1,7,2,7]) => [3,0,3,1,3,2,3] myreplaceall(3,9,[7,0,7,1,7,2,7]) => [7,0,7,1,7,2,7]




