This project is read-only.
Lists and Folding

Lists, Tuples and Options
Description: This sample shows simple uses of 'fold' to accumulate a result over a list
let ListSample5() =
let data = [("Cats",4);
let count = List.fold (fun acc (nm,x) -> acc+x) 0 data
printfn "Total number of animals: %d" count

Execution Result:
Total number of animals: 14

Last edited Sep 14, 2011 at 3:50 AM by ttliu2000, version 1


No comments yet.