This project is read-only.
Lists and Choose

Lists, Tuples and Options
Description: Project from a list
let ListSample7() =
let data = [("Cats",4);
let res = data |> List.choose (fun (nm,x) -> if nm.Length <= 4 then Some(x) else None)
printfn "Counts of animals with short names: %A" res

Execution Result:
Counts of animals with short names: [4; 5; 3]

Last edited Sep 14, 2011 at 3:51 AM by ttliu2000, version 1


No comments yet.