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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started