English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Pattern matching over elements at the front of a container
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-06-28 (17:11)
From: Jon Harrop <postmaster@j...>
Subject: Re: [Caml-list] Pattern matching over elements at the front of a container
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.


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