This project is read-only.
Using .map

Category:
Functions - Arrays, Lists, Seqs
Description: .map applies a given function to each element in the collection, returning a new collection.
Code:
let AggregateExample2() =
// can be applied to arrays and sequences as well
let aoList2 = List.map (fun (a,b,c) ->
let date = new System.DateTime(c, a, b)
date.ToString("F")) [(1,1,2001); (2,2,2004); (6,17,2009)]

for i in aoList2 do printfn "%A" i

Execution Result:
"Monday, January 01, 2001 12:00:00 AM"
"Monday, February 02, 2004 12:00:00 AM"
"Wednesday, June 17, 2009 12:00:00 AM"

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

Comments

No comments yet.