Again this is not too difficult -- After a little while, however, we'll be back into the more challenging stuff.
"Reverse a list."
1 #light
2
3 let listerine = [1 .. 40] |> List.rev |> List.iter (printfn "%d")
Basically everything looks familiar until we get to the List.iter statement. In case it's not obvious, the iter statement traverses thru each element of the list -- so really all we're doing is reversing the list we've created and printing each element.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
Tags:
99 problems,
f#,
iter
Categories:
F#