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
[oliver: Re: [Caml-list] Strings as arrays or lists...]
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-03-04 (19:01)
From: Nicolas George <nicolas.george@e...>
Subject: Re: [Caml-list] [RANT] String representation (was: Strings as arrays or lists...)
Le quartidi 14 ventôse, an CCXI, Diego Olivier Fernandez Pons a écrit :
> Some of the features you wish are 'not so hard to implement', at least
> if you already have 'conceptually bugged low-level' strings :

Of course it is possible to do it in "userland". But having it as part
of language has several advantages: cleaner syntax, compile-time
optimizations, code uniqueness.

> You can easily hava a (log n/k + 1) acces where n is the total size of
> the string and k is the size of each bucket (if you choose a data
> structure with constant buffer size)

I really feel that strings do not need fast random access by integer
index at all.

>> - there is also a `cursor' type, which is something like a pair
>> (string, index in that string);
> Easy... You can even do better : using a zipper you have constant
> acces to the pointed element

The cursors I was speaking _must_ provide constant-time access! And
(mean-)constant incrementation/decrementation.

Le quartidi 14 ventôse, an CCXI, David Chase a écrit :
>         sb.append(...);

This is really imperative style.