caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Thorsten Ohl <ohl@hep.tu-darmstadt.de>
To: caml-list@inria.fr
Subject: Immutable arrays (modest Feature request)
Date: Wed, 12 Jan 2000 16:45:42 +0100	[thread overview]
Message-ID: <200001121545.QAA25233@heplix4.ikp.physik.tu-darmstadt.de> (raw)

I've always wondered why O'Caml has no notion of immutable arrays or
vectors.  (Mutable) Arrays are often inconvenient because callers and
callees must negotiate who is doing the copying.  A conservative
approach will do too many copies.

Semantically, a vector of size n would be a record with
labels 0,...,n-1 and with O(1) access.  One would initialize them from
a constant (e.g. let v = [{ 42; 137; 1789 }]), a list, an array, or a
function. Updates would be requested by [{ v with 2 = 2000 }] and most
of the Array and List library is useful for vectors.

I admit that this is theoretically not very exciting (except for the
question when the `with' must copy and when not), but rather useful.

Cheers,
-Thorsten
-- 
Thorsten Ohl, Physics Department, TU Darmstadt -- ohl@hep.tu-darmstadt.de
http://heplix.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]




             reply	other threads:[~2000-01-12 22:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-12 15:45 Thorsten Ohl [this message]
2000-01-12 22:06 ` Pierre Weis
2000-01-12 22:35   ` Norman Ramsey
     [not found] <pfitzen@informatik.uni-tuebingen.de>
2000-01-13 19:45 ` Juergen Pfitzenmaier
2000-01-14 18:09   ` Mark Hayden
2000-01-14 20:29     ` Markus Mottl

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=200001121545.QAA25233@heplix4.ikp.physik.tu-darmstadt.de \
    --to=ohl@hep.tu-darmstadt.de \
    --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).