Browse thread
[Caml-list] AST and "when"
-
Mike Potanin
-
Olivier Andrieu
-
Mike Potanin
-
Olivier Andrieu
- Mike Potanin
-
Olivier Andrieu
-
Mike Potanin
-
Olivier Andrieu
[
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: | 2003-01-29 (16:35) |
From: | Mike Potanin <potanin@m...> |
Subject: | Re: [Caml-list] AST and "when" |
On Wed, 29 Jan 2003, Olivier Andrieu wrote: Whether I can make "formula" quotation so it compile match e with <:formula< sin(@x) ^ 2 + cos(@x) ^ 2 >> -> <:formula< 1 >> to match e with (Sum [(Pow1 (Sin x) 2); (Pow1 (Cos x_temp) 2)]) when x==x_temp -> Const 1 Or I mast write match e with <:formula< sin(@x) ^ 2 + cos(@y) ^ 2 >> when x==y -> <:formula< 1 >> > Mike Potanin [Wednesday 29 January 2003] : > > I don't think so: in `a when a<0', only the first `a' is a pattern, > the when + expr is part of the `match' (or `try' or `function') > construct which is at the expression level. > > > (MLast.PaLid ((0, 0), "a"), > > Some > > (MLast.ExApp ((0, 0), > > MLast.ExApp ((0, 0), MLast.ExLid ((0, 0), "<"), > > MLast.ExLid ((0, 0), "a")), > > MLast.ExInt ((0, 0), "0"))) > > that's not a single pattern (MLast.patt), that's a tuple of type > `MLast.patt * MLast.expr option' ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners