Rtag ((_,_,_,_) as t4) -> t4
Will this work? Writing from the phone
On 10/19/2017 04:16 PM, vrotaru.md@gmail.com wrote:
> [ Rtag (_,_,_,_) as rtag] -> rtag
That is certainly possible.
It is equivalent to:
| [rtag] -> rtag
but that's not what I am trying to do. :-/
Instead of the whole
Rtag (something1, something2, something3, something4)
I would like to bind just the 4-tuple
(without the Rtag label).
>
>
> On Thu, Oct 19, 2017, 16:39 Matej Košík <mail@matej-kosik.net <mailto:mail@matej-kosik.net>> wrote:
>
> Hi,
>
> I am trying to do simple pattern matching of these values:
> https://github.com/ocaml/ocaml/blob/trunk/parsing/parsetree.mli#L145
>
> What I would like to do is:
>
> | [Rtag the_whole_4_tuple] ->
> the_whole_4_tuple
>
> However, when I try to do that, I am getting:
>
> Error: The constructor Rtag expects 4 argument(s),
> but is applied here to 1 argument(s)
>
> This:
>
> | [Rtag (f1,f2,f3,f4)] ->
> f1,f2,f3,f4
>
> of course works but (regardless of the chosen bound variable names), it looks amateurish.
>
> What's the right way to do this?
> (I would like just to bind a 4-tuple and then return it)
>
> (Apologies in advance for a stupid question.)
>