I am trying to access the fst element of a tuple. Normally I use fst (tuple), but this situation is a little different.
let getCard (pl : player) : (card * player) option =
let plDeck = pl
match plDeck with
| c1::re -> Some (c1,(re))
| [] -> None
This is my f# code. the player type is a list of ints, and the output is tuple with the first int of the player list, and the player list minus the first int.
It's an assignment from my computer science class, so it is required that I use the option type.
I am trying to access the fst element of the tuple in another function by writing
let gc = fst (getCard [1,2,3])
but it seems like I can't do it this way, since I am getting the warning:
This expression was expected to have type ''a * 'b' but here has type '(card * player) option'
How do I work around this?