caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "David McClain" <dmcclain1@mindspring.com>
To: <caml-list@inria.fr>
Subject: Re: [Caml-list] petty complaints
Date: Mon, 9 Apr 2001 09:24:37 -0700	[thread overview]
Message-ID: <004101c0c111$960022d0$210148bf@dylan> (raw)
In-Reply-To: <20010409113449.A19116@lakeland.eecs.harvard.edu>

> Haskell allows to
> use any identifier as a binary operator when it is placed in
> backquotes:  x `plus` y.  These operators are often more readable than
> the classic infix operator symbols.  These terms have no associativity
> and a low precedence, thus forcing to use parentheses.  An
> implementation would only affect the lexer and should not be too hard.
> Would other people like this feature, too?

Yes, indeed! I have implemented this in my NML which is a very simple
language in comparison to OCaml, but it borrowed the OCaml Lex and Yacc as
starting points. It was very easy to implement this feature and I tend to
use it most often with integer divide, modulo, and the bit twiddling
primitives, as in

    let x = y `mod` z in ...

I also have a syntax for list and vector comprehensions, a la Haskell. Very
convenient for terse programming, e.g.,

    let x = [(a,b) |: a <- [1 .. 100], b <- 100 - a] in ...

- DM

----- Original Message -----
From: "Christian Lindig" <lindig@eecs.harvard.edu>
To: "Caml Mailing List" <caml-list@inria.fr>
Sent: Monday, April 09, 2001 8:34 AM
Subject: Re: [Caml-list] petty complaints


> On Sun, Apr 01, 2001 at 09:26:59PM -0700, Brian Rogoff wrote:
> >     Another unrelated trifling question concerns the syntax of numerical
> > literals.
>
> Now that the spring cleaning for OCaml's syntax (floats, labels,
> constructors) is in full swing, here is my wish:  Haskell allows to
> use any identifier as a binary operator when it is placed in
> backquotes:  x `plus` y.  These operators are often more readable than
> the classic infix operator symbols.  These terms have no associativity
> and a low precedence, thus forcing to use parentheses.  An
> implementation would only affect the lexer and should not be too hard.
> Would other people like this feature, too?
>
> -- Christian
>
> --
> Christian Lindig          Harvard University - DEAS
> lindig@eecs.harvard.edu   33 Oxford St, MD 242, Cambridge MA 02138
> phone: +1 (617) 496-7157  http://www.eecs.harvard.edu/~lindig/
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr.  Archives:
http://caml.inria.fr

-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-04-09 16:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-02  4:26 Brian Rogoff
2001-04-02 13:32 ` Xavier Leroy
2001-04-02 15:24   ` Brian Rogoff
2001-04-02 20:17   ` Chris Hecker
2001-04-02 19:45     ` Brian Rogoff
2001-04-09  5:23 ` John Max Skaller
2001-04-09 15:34 ` Christian Lindig
2001-04-09 16:01   ` Brian Rogoff
2001-04-09 16:24   ` David McClain [this message]
2001-04-09 16:29   ` Pierre Weis
2001-04-10 22:25     ` Marcin 'Qrczak' Kowalczyk
2001-04-24 15:23 [Caml-list] Petty complaints Brian Rogoff
2001-04-25  6:55 ` Fabrice Le Fessant
2001-04-25  7:00   ` Fabrice Le Fessant

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='004101c0c111$960022d0$210148bf@dylan' \
    --to=dmcclain1@mindspring.com \
    --cc=caml-list@inria.fr \
    /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).