Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] infix precedence
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] infix precedence
Hi,

On Tue, May 28, 2002 at 10:48:33PM -0400, dengping zhu wrote:

> Hi, Daniel, it works very well.
> Thanks a lot!

Thanks. BTW, another way to turn around the problem of "let (op1) x y"
which does not work (the problem is actually more complicated that I
thought), you can give the function another name, for example by
changing:
    [ [ x = SELF; $op$; y = SELF -> <:expr< $lid:op$ $x$ $y$ >> ] ];
into:
    [ [ x = SELF; $op$; y = SELF -> <:expr< $lid:"f_" ^ op$ $x$ $y$ >> ] ];

This way, when doing
    add_infix "*" "op1"

the rule creates the infix "op1" associated with the function "f_op1"
that you can define without parsing problem with:
    let f_op1 x y = ...

and "a op1 b" is therefore equivalent to "f_op1 a b".

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
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