$30
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.
1) myremoveduplicates
myremoveduplicates("abacad") => "bcad" myremoveduplicates([3,2,1,3,2,2,1,1]) => [3,2,1]
2) myintersection
myintersection("abc", "bcd") => "bc" myintersection([3,4,2,1], [5,4,1,6,2]) => [4,2,1] myintersection([], [1,2,3]) => [] myintersection("abc", "") => ""
3) mylast mylast("") => "" mylast("b") => "b" mylast("abcd") => "d" mylast([1,2,3,4]) => [4] mylast([]) => []
4) myreverse
myreverse("") => "" myreverse("abc") => "cba" myreverse([1,2,3]) => [3,2,1] myreverse([]) => []
5) 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]