From: Richard Jones <rich@annexia.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Observations on OCaml vs. Haskell
Date: Tue, 28 Sep 2004 09:27:10 +0100 [thread overview]
Message-ID: <20040928082710.GA28560@annexia.org> (raw)
In-Reply-To: <200409271408.51872.jgoerzen@complete.org>
[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]
On Mon, Sep 27, 2004 at 02:08:51PM -0500, John Goerzen wrote:
> It's annoying that strings aren't normally processed this way in OCaml,
> and even more annoying that (^) or (::) cannot be used in pattern
> matching over strings.
While having strings represented as lists of characters is a bad idea
for performance reasons, I don't see why we can't allow more advanced
pattern matching than simply just string equality. I'd like to see at
least:
match str with
"prefix" ^ rest -> ...
which is very useful when parsing up certain types of CGI query
strings, and even better would be full regexp support:
match str with
"^(.+)-(.+)$" as f, t
-> printf "range: from '%s' to '%s'" f t
| "^(.+)$" as v -> printf "singular: '%s'" v
(this example taken from Yutaka Oiwa's regexp syntax extension written
in camlp4).
Rich.
--
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
'There is a joke about American engineers and French engineers. The
American team brings a prototype to the French team. The French team's
response is: "Well, it works fine in practice; but how will it hold up
in theory?"'
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
prev parent reply other threads:[~2004-09-28 8:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-27 19:08 John Goerzen
2004-09-27 20:24 ` Rafael 'Dido' Sevilla
2004-09-27 21:34 ` Danny Yoo
2004-09-28 7:22 ` Ville-Pertti Keinonen
2004-09-28 18:02 ` Jon Harrop
2004-09-29 14:26 ` Brian Hurt
2004-09-29 14:20 ` Jon Harrop
2004-09-29 15:03 ` Dmitry Lomov
2004-09-28 10:10 ` [Caml-list] Caml monomorphisation (was Observations on OCaml vs. Haskell) Diego Olivier Fernandez Pons
2004-09-28 12:01 ` Richard Jones
2004-09-28 17:50 ` Jon Harrop
2004-09-28 1:56 ` [Caml-list] Observations on OCaml vs. Haskell skaller
2004-09-28 9:31 ` Keith Wansbrough
2004-09-28 9:55 ` Rafael 'Dido' Sevilla
2004-09-27 21:11 ` Christophe TROESTLER
2004-09-28 1:32 ` Jacques GARRIGUE
2004-09-28 1:46 ` skaller
2004-09-28 8:27 ` Richard Jones [this message]
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=20040928082710.GA28560@annexia.org \
--to=rich@annexia.org \
--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