Advertisement
Guest User

Untitled

a guest
Oct 4th, 2015
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.47 KB | None | 0 0
  1. // Learn more about F# at http://fsharp.org
  2. // See the 'F# Tutorial' project for more help.
  3.  
  4. let rec sum'' xs =
  5.     match xs with
  6.     | []     -> 0
  7.     | hd::tl -> hd + sum'' tl
  8.  
  9. let sum' xs =
  10.    let rec loop xs' acc =
  11.         match xs' with
  12.        | []     -> acc
  13.        | hd::tl -> loop tl (hd+acc)
  14.    match xs with
  15.    | []     -> 0
  16.    | hd::tl -> loop tl hd
  17.  
  18. [<EntryPoint>]
  19. let main argv =
  20.    printfn "%A" argv
  21.    0 // return an integer exit code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement