I'm still learning SML, so my apologies if this is a rather dumb question. I was wondering if there was a better way to do pattern matching on some constructs outside of functions.
For example, let's say we have a type
type coord = int * int * int
And then we have some value b
of type coord
. I understand that we can do pattern matching in functions, for example:
fun get_x_coord ((x, y, z) : coord) = x
But let's say we're working with b
inside of another function not given as a parameter. I feel like doing
case b of
(x,y,z) => (* do stuff *)
is rather clunky if I have a single result that I want (for example I know there will be three integer values and I just want to isolate them).
Is there a better way to do this?