Answers for "f# list map function"

C#
0

f# list map function

let squares = [2; 4; 6; 8]
              |> List.map (fun n -> n * n)
// val squares : int list = [4; 16; 36; 64]
Posted by: Guest on May-01-2021
0

f# list map function

let toUpper = fun c -> System.Char.ToUpper(c)
let allcaps = "sesquipedalian"
              |> String.map toUpper
// val allcaps : string = "SESQUIPEDALIAN"
Posted by: Guest on May-01-2021
0

f# list map function

let f = fun n -> n * n
let squares = [2; 4; 6; 8] |> List.map f
// val squares : int list = [4; 16; 36; 64]
Posted by: Guest on May-01-2021

C# Answers by Framework

Browse Popular Code Answers by Language