(*
We have refactored sample.fs further to use the List built-in
functions to find sum and max.
*)

let printList (lst : int list) = 
  List.iter (fun e -> printf "%d " e) lst
  printfn ""

let list = [1; 2; 3; 6; 5; 1]
printf "The original list is "
printList list

printf "The doubled list is "
printList (List.map (fun e -> e * 2) list)

printf "The total of elements in list is "
printfn "%d" (List.reduce (fun carry e -> carry + e) list)

printf "The max value amount elements in the list is "
printfn "%d" (List.fold (fun max e -> if max < e then e else max) System.Int32.MinValue list)
