English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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 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