caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: dengping zhu <zhudp@cs.bu.edu>
To: John Prevost <j.prevost@cs.cmu.edu>
Cc: Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] infix precedence
Date: Tue, 28 May 2002 13:19:28 -0400 (EDT)	[thread overview]
Message-ID: <Pine.SOL.4.20.0205281308380.4380-100000@csa.bu.edu> (raw)
In-Reply-To: <86k7pofejb.fsf@laurelin.dementia.org>


Thanks for your prompt reply. So, the associativity also the same as the
first character.

Then, I have problems with the following code. In SML, I defined a few
infix as follows:

infixr 4 << >>
infixr 3 &&
infix 2 -- ##
infix 2 wth suchthat return guard
infixr 1 ||
				
I want to convert these code into ocaml. How can find so many different
'first characters'? Because the available characters in ocaml are:

**...            right
*... /... %...   left
+... -...        left
@... ^...        right

Do you have any sugestion?

Thanks a lot!

Dengping


On 28 May 2002, John Prevost wrote:

>>>>>> "zd" == dengping zhu <zhudp@cs.bu.edu> writes:
>
>    zd> Hi, all, I have a question about the precedence of infix in
>    zd> ocaml.  I define a few infixes as follow:
>
>    zd> let (^^) x y = ...  let (^+) x y = ...  let (^<) x y = ...
>
>    zd> Now how can I define the precedence of them?  At first, I want
>    zd> to use brackets to solve it, but later I find out it is almost
>    zd> impossible because there are a lot of recursive functions and
>    zd> combination of these infixes.
>
>    zd> Can you give me any idea?  Thanks a lot!
>
>The precedence and fixity of the infix is determined by the first character.  This is why most "families" of infixes look like:
>
>^^
>+^
><^
>
>rather than
>
>^^
>^+
>^<
>
>John.
>

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


  reply	other threads:[~2002-05-28 17:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-28 15:42 dengping zhu
2002-05-28 15:54 ` Remi VANICAT
2002-05-28 16:00 ` John Prevost
2002-05-28 17:19   ` dengping zhu [this message]
2002-05-28 18:07     ` John Prevost
2002-05-28 18:16       ` dengping zhu
2002-05-28 18:32         ` Daniel de Rauglaudre
2002-05-28 18:48           ` dengping zhu
2002-05-28 22:44             ` Daniel de Rauglaudre
2002-05-29  2:48               ` dengping zhu
2002-05-29  8:42                 ` Daniel de Rauglaudre
2002-06-21 17:54                 ` dengping zhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.SOL.4.20.0205281308380.4380-100000@csa.bu.edu \
    --to=zhudp@cs.bu.edu \
    --cc=caml-list@inria.fr \
    --cc=j.prevost@cs.cmu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).