From: David Kastrup <dak@gnu.org>
To: guile-devel@gnu.org
Subject: Re: Growable arrays
Date: Thu, 14 Jun 2012 21:35:48 +0200 [thread overview]
Message-ID: <87y5npu1nv.fsf@fencepost.gnu.org> (raw)
In-Reply-To: 12BB3FF3-FB23-4F85-B970-29044E367557@bluewin.ch
Daniel Llorens <daniel.llorens@bluewin.ch> writes:
> I do not think this is a good idea. Guile arrays are just views of a
> vector. Are you proposing to have a separate array implementation? The
> resize operation clashes with the notion of shared views, and it only
> makes sense for arrays of rank 1. It can defined on the ravel (the old
> C++ library, Blitz++, has it) but I don't quite see how it would work
> in Scheme.
>
> It's true that arrays are complex. They should be simpler. For
> example, I'd remove the arbitrary lower bound feature. Do people use
> it? I've never used it, and I use arrays all the time.
If you take a look at "Numerical Recipes in C" (unless they got their
act together in a later edition), they just mapped the Fortran code 1:1
to C. And I mean 1:1 and not 1:0. They left the 0 index empty. And
implemented arrays not as "a view" on a vector, but rather as as a
vector of independently allocated vectors. Of course, all on the heap.
I should think that being able to interchange 0/1 based would be the
most important application. Then you would want to have this feature
for translating Pascal programs (they are start index agnostic).
Indexes in math often run from 1, being able to translate into a
straightforward 1-based rendition can avoid transliteration errors.
It is definitely a higher-level feature and not a fundamental property
of underlying primitive data types, though.
--
David Kastrup
next prev parent reply other threads:[~2012-06-14 19:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.195.1339689634.7965.guile-devel@gnu.org>
2012-06-14 18:23 ` Growable arrays Daniel Llorens
2012-06-14 19:35 ` David Kastrup [this message]
[not found] <mailman.181.1339776038.12100.guile-devel@gnu.org>
2012-06-15 17:19 ` Daniel Llorens
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y5npu1nv.fsf@fencepost.gnu.org \
--to=dak@gnu.org \
--cc=guile-devel@gnu.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).