Problem #5

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. 

kick it on DotNetKicks.com  


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags: , ,
Categories: F#

4 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed