[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Denis Bueno <dbueno@g...> |
| Subject: | Variable pattern matching tuple |
The following is not intuitive to me.
# type 'a withint = Withint of 'a * int;;
type 'a withint = Withint of 'a * int
# let foo = Withint ("hi there", 4);;
val foo : string withint = Withint ("hi there", 4)
# match foo with Withint _ -> ();;
- : unit = ()
# match foo with Withint d -> d;; (* expression A*)
Characters 15-24:
match foo with Withint d -> d;;
^^^^^^^^^
The constructor Withint expects 2 argument(s),
but is here applied to 1 argument(s)
#
What is the reason that expression A won't compile? Can't one variable
stand for a tuple in a pattern-matching clause?
-Denis