From: Tom <tom.primozic@gmail.com>
To: skaller <skaller@users.sourceforge.net>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] proposed extenion to patterns
Date: Fri, 9 Mar 2007 08:34:38 +0100 [thread overview]
Message-ID: <c1490a380703082334v5aa1aa46ha7681e07a3c849e6@mail.gmail.com> (raw)
In-Reply-To: <1173405721.9499.13.camel@rosella.wigram>
[-- Attachment #1: Type: text/plain, Size: 902 bytes --]
On 09/03/07, skaller <skaller@users.sourceforge.net> wrote:
>
> Pattern matches in Ocaml now allow alternatives within
> a branch subject to a restriction that all alternatives
> supply the same set of pattern variables (and of the same type).
>
> This is useful but still quite restrictive, for example:
>
> | A (i,j) | B i with j = 1 -> i + j
I think this is a good idea.
This form looks more general:
>
> | in A (h,k) let i = h and k = k
> | in B s let i = s + 1 let k = i
>
But I find this too complicated (for a programmer to memorize the syntax,
write it and someone else read it). You could simply say:
| A (h as i, k as k)
| B s with i = s + 1 and k = i
I know that this would introduce some problems (not equal variable in both
branches, but this could easily be solved (the compiler only complaining
when a non-common variable is actually used (in this example, h and s)).
- Tom
[-- Attachment #2: Type: text/html, Size: 1408 bytes --]
next prev parent reply other threads:[~2007-03-09 7:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-09 2:02 skaller
2007-03-09 7:34 ` Tom [this message]
2007-03-09 10:08 ` [Caml-list] " Jon Harrop
2007-03-09 11:19 ` skaller
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=c1490a380703082334v5aa1aa46ha7681e07a3c849e6@mail.gmail.com \
--to=tom.primozic@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=skaller@users.sourceforge.net \
/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