Latest update Dec. 19, 2022
Define a function that converts the characters a, b, and c to capitals. All other characters should be returned unchanged. You are not allowed to use the standard F# method .ToUpper() on strings!
Then, write a function to convert all occurrences of a, b, and c in a string to capitals! Write both a version that uses direct recursion, and a version that uses some appropriate higher-order function on strings. Again, you are not allowed to use the standard F# method .ToUpper() on strings.
Then define a function that returns true if any match is found anywhere in the list, and false otherwise.
You don't have to use any sophisticated list matching algorithm, a straightforward one suffices.
let f x y = x + y let g (x,y) = x + yExplain the difference between f and g!
let rec map f l = match l with | [] -> [] | head :: tail -> f head :: map f tail
let rec take n l = match (n,l) with (_,[]) -> failwith "List too short" (0,_) -> [] (_,x::xs) -> x :: take (n-1) xs
Suggested solutions are available.