caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Arthur Chan" <baguasquirrel@gmail.com>
To: "Till Crueger" <crueger@informatik.uni-bonn.de>
Cc: "Richard Jones" <rich@annexia.org>,
	Caml <caml-list@yquem.inria.fr>,
	"David Teller" <David.Teller@univ-orleans.fr>
Subject: Re: [Caml-list] [OSR] Standard syntax extensions ?
Date: Sat, 26 Apr 2008 14:32:26 -0700	[thread overview]
Message-ID: <74cabd9e0804261432o116f4db5w2f5777496da17d94@mail.gmail.com> (raw)
In-Reply-To: <op.t97j6yp6tayt6l@reitoei.dyndns.info>

[-- Attachment #1: Type: text/plain, Size: 2571 bytes --]

As Till Crueger suggested, sometimes the infix syntax makes more sense.
More than that, one of the intents of the original ML language was to create
a language that was clear in its intents and *provably correct* (at least
that was what I was taught in school.  ocaml apparently isn't completely
provably correct but the functional parts of it are).  That said, there are
some of us who feel that that the python infix syntax is clearer, and as it
corresponds more directly to the mathematical notation, it is just as
provably correct as the List.mem notation is.  If reusing "in" is a big
deal, then maybe we could do "in_list" or "inlist"?  That'd be more
type-safe too.

The python syntax goes further than just the "in" bit, in fact.  They can do
list comprehensions like [for x in blah if f(x)].  Now every functional guru
will recognize this immediately as the bastardization of List.filter.  While
it'd be nice to have that, I come across List.filter much less than
List.exists/mem.

Whatever....  it's just a minor quibble, but this thread was about syntax
extensions, after all.




On Sat, Apr 26, 2008 at 12:53 AM, Till Crueger <
crueger@informatik.uni-bonn.de> wrote:

> On Sat, 26 Apr 2008 09:41:57 +0200, Richard Jones <rich@annexia.org>
> wrote:
>
>  I'm guessing that there will be ambiguity because you're wanting to
> > add yet another meaning to the reserved word 'in'.
> >
> > However I'm not sure why you don't just use 'List.mem', or even:
> >
> >  let mem = List.mem ;;
> >
> >  mem 1 [1;2;3]
> >
>
> Since I am reading the "Haskell School of expressions" right now (to
> become better at functional Programming, not to leave my favourite language
> :)) I am starting to like the way you can turn any function into an infix
> operator by using quotes. Wouldn't it be possible to have something similar
> to this in OCaml? I don't think there is an easy way to do this yet, since I
> didn't find anything on this topic.
>
> I am posting this in this thread, because this would allow us to write the
> above more elegantly as:
> 1 `mem` [1;2;3], which is close to what was originally proposed.
>
> What do you think of this?
>
> bye,
>  Till
>
>
> --
> There once was a man from the sticks
> Who liked to compose limericks.
> But he failed at the sport,
> For he wrote 'em too short.
>



-- 
-----------------------------------------------------------------------
(\__/)
(='.'=)This is Bunny. Copy and paste Bunny into your
(")_(")signature to help him gain world domination.
------------------------------------------------------------------------

[-- Attachment #2: Type: text/html, Size: 3333 bytes --]

  reply	other threads:[~2008-04-26 21:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-24 15:49 David Teller
2008-04-24 15:52 ` [Caml-list] " John Whitington
2008-04-25  8:22   ` Richard Jones
2008-05-01  7:45     ` Richard Jones
2008-04-24 16:16 ` [Caml-list] [OSR] Standard syntax extensions ? - voting Stefano Zacchiroli
2008-04-25 15:15   ` David Teller
2008-04-26  0:16     ` Stefano Zacchiroli
2008-04-24 16:41 ` [Caml-list] [OSR] Standard syntax extensions ? Martin Jambon
2008-04-24 17:02   ` Jon Harrop
2008-04-24 20:53     ` Berke Durak
2008-04-25  8:24       ` Richard Jones
2008-04-25 16:59         ` Berke Durak
2008-04-25 17:31           ` Gerd Stolpmann
2008-04-25 17:38           ` Richard Jones
2008-04-25 10:33       ` Andrej Bauer
2008-04-25 15:32     ` David Teller
2008-04-24 17:05 ` Dario Teixeira
2008-04-25 13:57   ` Peng Zang
2008-04-25 15:04     ` David Teller
2008-04-25 16:11       ` Peng Zang
2008-04-25 20:37 ` Arthur Chan
2008-04-26  7:41   ` Richard Jones
2008-04-26  7:53     ` Till Crueger
2008-04-26 21:32       ` Arthur Chan [this message]
2008-04-27  6:58         ` Andrej Bauer
2008-04-27 14:14           ` Christopher L Conway
2008-04-27 17:41         ` [Caml-list] " David Teller
2008-04-27 17:44       ` David Teller
2008-04-25 22:25 ` Mike Lin

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=74cabd9e0804261432o116f4db5w2f5777496da17d94@mail.gmail.com \
    --to=baguasquirrel@gmail.com \
    --cc=David.Teller@univ-orleans.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=crueger@informatik.uni-bonn.de \
    --cc=rich@annexia.org \
    /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).