From: Jon Harrop <postmaster@jdh30.plus.com>
To: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Pattern matching over elements at the front of a container
Date: Mon, 28 Jun 2004 18:09:06 +0100 [thread overview]
Message-ID: <200406281809.06524.postmaster@jdh30.plus.com> (raw)
In-Reply-To: <20040628145053.A29706@beaune.inria.fr>
On Monday 28 June 2004 13:50, Luc Maranget wrote:
> ...
> Your ``...'' are sequences (?) they imply additional costs
> (BTY one can also consider those for lists , written for instance
> ... @ [1] @ ... )
I was working on the implicit assumption that bindings could only appear at
the ends of the array and, therefore, pattern matching (e.g. [|h; ..|], [|..;
h|] or [|h1; ..; h2|]) can all be guaranteed to be O(1) because they equate
to, for example, "if Array.length a>1 then ..." with a binding for h
equivalent to "let h=Array.get a 1 in ...". This seems (to me) to be an
elegant equivalent to cons on lists although, of course, you can't access the
tail in O(1) in the case of an array (hence I'm not allowing it to be named)
and you can't reverse the meaning of the cons in O(1) on a list. I wasn't
suggesting that something like [|..; h1; ..; h2; ..|] be allowed.
I'll swat up on the rest (e.g. the Church-Rosser property) before replying,
but I think I understand and agree with what you're saying.
Cheers,
Jon.
-------------------
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
prev parent reply other threads:[~2004-06-28 17:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-26 11:15 Jon Harrop
2004-06-26 13:36 ` skaller
2004-06-27 10:11 ` Richard Jones
2004-06-27 11:40 ` William Lovas
2004-06-28 7:57 ` Luc Maranget
2004-06-28 12:01 ` Jon Harrop
2004-06-28 12:50 ` Luc Maranget
2004-06-28 17:09 ` Jon Harrop [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=200406281809.06524.postmaster@jdh30.plus.com \
--to=postmaster@jdh30.plus.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).