Seq.map creates a new sequence, which is lazy i.e. not evaluated till it is enumerated. To make this sample work what you can do is:

1
2
let mySeq = Seq.map (fun s -> printfn "%s" s) [|"c"|]
printfn "%A" mySeq

Here you bind the sequence you create to a identifier mySeq and enumerate it to cause the side effect (printing to the console). But this probably is what you wanted to do, if you just want to enumerate a sequence apply a side effect function to each element use Seq.iter:

1
Seq.iter (fun s -> printfn "%s" s) [|"c"|]

Cheers,
Rob

By on 11/5/2008 1:28 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper