Question: F# Write a function: toUpper : string -> string so that toUpper s returns the string s with all characters in upper case: toUpper Hej
F#
Write a function:
toUpper : string -> string so that toUpper s returns the string s with all characters in upper case: toUpper "Hej" = "HEJ" Hint: Use System.Char.ToUpper to convert characters to upper case. You can do it in one line using implode, List.map and explode. Write the same function toUpper1 using forward function composition ((f g) x = g(f x)) . Write the same function toUpper2 using the pipe-forward operator (|>) and backward function composition (). Hint: is defined as (f g) x = (f o g) x = f(g(x)). Hint: |> is defined as x |> f = f x. The two operators are by default supported by F#. You can have F# interactive print the types: > (<<);; val it : ((a -> b) -> (c -> a) -> c -> b) = > (|>);; val it : (a -> (a -> b) -> b) = > (>>);; val it : ((a -> b) -> (b -> c) -> a -> c) =
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
