caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] beginner question about pattern matching
@ 2017-10-19 13:38 Matej Košík
  2017-10-19 14:16 ` vrotaru.md
  2017-10-19 14:34 ` Gabriel Scherer
  0 siblings, 2 replies; 9+ messages in thread
From: Matej Košík @ 2017-10-19 13:38 UTC (permalink / raw)
  To: caml-list


[-- Attachment #1.1: Type: text/plain, Size: 683 bytes --]

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.)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-10-19 14:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19 13:38 [Caml-list] beginner question about pattern matching Matej Košík
2017-10-19 14:16 ` vrotaru.md
2017-10-19 14:24   ` Matej Košík
2017-10-19 14:29     ` vrotaru.md
2017-10-19 14:30       ` Olivier Nicole
2017-10-19 14:31     ` Alan Schmitt
2017-10-19 14:34 ` Gabriel Scherer
2017-10-19 14:40   ` Matej Košík
2017-10-19 14:44   ` vrotaru.md

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).