From: John Max Skaller <skaller@ozemail.com.au>
To: Luc Maranget <luc.maranget@inria.fr>
Cc: Nicolas Cannasse <warplayer@free.fr>, OCaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Matching when
Date: Tue, 06 Aug 2002 02:13:15 +1000 [thread overview]
Message-ID: <3D4EA41B.8080502@ozemail.com.au> (raw)
In-Reply-To: <200208050941.LAA0000029449@beaune.inria.fr>
Luc Maranget wrote:
>>What you are asking is ``pattern when expression'' to be a pattern.
>>Then your example would be parsed as
>>
>>That is your example is to to be parsed as
>> Any <-- pattern |
>>| | Pattern (or pat)
>> Int x when x > 0 <-- pattern |
>>->
>> ... <-- right hand side
>>
>>
>>Modifications are really important because this would make patterns and
>>expression mutually recursive, which they are not at the moment.
>>
The follwing code works in Felix [it prints "YES"]
#include <std.flx>
match (2,1) with
| ( (?x when x>=1), (?y when y >=1)) when x >=2 => { print "YES"; endl; }
| _ => { print "NO"; endl; }
endmatch;
wherein 'when' expressions are part of patterns, and as you can see,
can be nested within a pattern -- making the grammar for patterns
and expressions mutually recursive.
I'm curious as to what problems you perceive with
the mutual recursion.
--
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850
-------------------
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
next prev parent reply other threads:[~2002-08-05 16:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-05 9:26 Nicolas Cannasse
2002-08-05 9:41 ` Luc Maranget
2002-08-05 16:13 ` John Max Skaller [this message]
2002-08-05 19:29 ` Luc Maranget
2002-08-05 20:16 ` [Caml-list] Sharing Files between OCaml and C Michael Tucker
2002-08-06 13:04 ` Olivier Andrieu
2002-08-06 14:01 ` Bruno.Verlyck
2002-08-06 18:50 ` Lex Stein
2002-08-07 11:40 ` Bruno.Verlyck
2002-08-05 13:05 ` [Caml-list] Matching when Pierre Weis
2002-08-05 15:50 ` John Max Skaller
2002-08-05 16:02 ` Remi VANICAT
2002-08-05 16:23 ` John Max Skaller
2002-08-05 18:25 ` Oleg
2002-08-06 6:37 ` Florian Hars
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=3D4EA41B.8080502@ozemail.com.au \
--to=skaller@ozemail.com.au \
--cc=caml-list@inria.fr \
--cc=luc.maranget@inria.fr \
--cc=warplayer@free.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