Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2002-05-29 (08:42)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] infix precedence

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
    [ [ x = SELF; $op$; y = SELF -> <:expr< $lid:op$ $x$ $y$ >> ] ];
    [ [ 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".

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: