Use pattern matching:

match (Seq.hd seqA) with

| (_, 2) -> doSomething

| _ -> doSomethingElse

By on 6/3/2009 10:47 PM ()

let seqA = seq [(1, 2); (3, 4)]

let b = snd (Seq.hd seqA)

By on 6/17/2009 1:32 PM ()

For 2-tuples, the functions 'fst' and 'snd' get the first and second elements respectively.

For larger tuples, you have to use pattern matching (but can easily define your own functions based on that, e.g.

let fstOf3 (x,y,z) = x

).

By on 6/3/2009 10:33 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