We've already done this in Problem #2 but for the sake of answering all the problems we'll do it again :)
"Find the number of elements of a list."
Using the built in list functions and the pipeline operator we come up with the answer pretty easily.
1 #light
2
3 let listerine = [1 .. 40] |> List.length |> printfn "List length: %d"
There are not really any new concepts in this solution -- on to problem 5! As always, please feel free to post your solution if it is any different / more elegant -- we're using this excerise a way to better learn the language.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
Tags:
99 problems,
f#
Categories:
F#