|
|
Extfun
and the syntax to be loaded is
"pa_extfun.cmo"
. The empty function is Extfun.empty
.
You can extend a function using the statement extfun
whose
syntax is:extfun expression with |
[ pattern-1 -> expression-1 |
| pattern-2 -> expression-2 |
... |
| pattern-n -> expression-n ] |
pat1 | pat2 -> exprThe binding is split into two cases (the expr is duplicated):
pat1 -> expr | pat2 -> exprInternal ``or'' patterns inside patterns are not accepted.
extfun
returns another extensible function. The
type of extensible functions is ('a, 'b) Extfun.t
. To use an
extensible function, one must use the function Extfun.apply
which transforms it in a function of type 'a -> 'b
. If matching
failed, such a function raises the exception Extfun.Failure
.Extfun.print
.
|
Fstream
and the syntax to be loaded is
"pa_fstream.cmo"
. The syntax of a functional