112 lines
5.1 KiB
HTML
112 lines
5.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<!-- This manual documents Guile version 3.0.10.
|
|
|
|
Copyright (C) 1996-1997, 2000-2005, 2009-2023 Free Software Foundation,
|
|
Inc.
|
|
|
|
Copyright (C) 2021 Maxime Devos
|
|
|
|
Copyright (C) 2024 Tomas Volf
|
|
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
|
any later version published by the Free Software Foundation; with no
|
|
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
|
|
copy of the license is included in the section entitled "GNU Free
|
|
Documentation License." -->
|
|
<title>Arrays (Guile Reference Manual)</title>
|
|
|
|
<meta name="description" content="Arrays (Guile Reference Manual)">
|
|
<meta name="keywords" content="Arrays (Guile Reference Manual)">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content=".texi2any-real">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
|
|
<link href="index.html" rel="start" title="Top">
|
|
<link href="Concept-Index.html" rel="index" title="Concept Index">
|
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
|
<link href="Data-Types.html" rel="up" title="Data Types">
|
|
<link href="VLists.html" rel="next" title="VLists">
|
|
<link href="Bytevectors.html" rel="prev" title="Bytevectors">
|
|
<style type="text/css">
|
|
<!--
|
|
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
|
|
span:hover a.copiable-link {visibility: visible}
|
|
-->
|
|
</style>
|
|
<link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css">
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en">
|
|
<div class="subsection-level-extent" id="Arrays">
|
|
<div class="nav-panel">
|
|
<p>
|
|
Next: <a href="VLists.html" accesskey="n" rel="next">VLists</a>, Previous: <a href="Bytevectors.html" accesskey="p" rel="prev">Bytevectors</a>, Up: <a href="Data-Types.html" accesskey="u" rel="up">Data Types</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<hr>
|
|
<h4 class="subsection" id="Arrays-1"><span>6.6.13 Arrays<a class="copiable-link" href="#Arrays-1"> ¶</a></span></h4>
|
|
<a class="index-entry-id" id="index-Arrays"></a>
|
|
|
|
<p><em class="dfn">Arrays</em> are a collection of cells organized into an arbitrary
|
|
number of dimensions. Each cell can be accessed in constant time by
|
|
supplying an index for each dimension.
|
|
</p>
|
|
<p>In the current implementation, an array uses a vector of some kind for
|
|
the actual storage of its elements. Any kind of vector will do, so you
|
|
can have arrays of uniform numeric values, arrays of characters, arrays
|
|
of bits, and of course, arrays of arbitrary Scheme values. For example,
|
|
arrays with an underlying <code class="code">c64vector</code> might be nice for digital
|
|
signal processing, while arrays made from a <code class="code">u8vector</code> might be
|
|
used to hold gray-scale images.
|
|
</p>
|
|
<p>The number of dimensions of an array is called its <em class="dfn">rank</em>. Thus,
|
|
a matrix is an array of rank 2, while a vector has rank 1. When
|
|
accessing an array element, you have to specify one exact integer for
|
|
each dimension. These integers are called the <em class="dfn">indices</em> of the
|
|
element. An array specifies the allowed range of indices for each
|
|
dimension via an inclusive lower and upper bound. These bounds can
|
|
well be negative, but the upper bound must be greater than or equal to
|
|
the lower bound minus one. When all lower bounds of an array are
|
|
zero, it is called a <em class="dfn">zero-origin</em> array.
|
|
</p>
|
|
<p>Arrays can be of rank 0, which could be interpreted as a scalar.
|
|
Thus, a zero-rank array can store exactly one object and the list of
|
|
indices of this element is the empty list.
|
|
</p>
|
|
<p>Arrays contain zero elements when one of their dimensions has a zero
|
|
length. These empty arrays maintain information about their shape: a
|
|
matrix with zero columns and 3 rows is different from a matrix with 3
|
|
columns and zero rows, which again is different from a vector of
|
|
length zero.
|
|
</p>
|
|
<p>The array procedures are all polymorphic, treating strings, uniform
|
|
numeric vectors, bytevectors, bit vectors and ordinary vectors as one
|
|
dimensional arrays.
|
|
</p>
|
|
|
|
<ul class="mini-toc">
|
|
<li><a href="Array-Syntax.html" accesskey="1">Array Syntax</a></li>
|
|
<li><a href="Array-Procedures.html" accesskey="2">Array Procedures</a></li>
|
|
<li><a href="Shared-Arrays.html" accesskey="3">Shared Arrays</a></li>
|
|
<li><a href="Arrays-as-arrays-of-arrays.html" accesskey="4">Arrays as arrays of arrays</a></li>
|
|
<li><a href="Accessing-Arrays-from-C.html" accesskey="5">Accessing Arrays from C</a></li>
|
|
</ul>
|
|
</div>
|
|
<hr>
|
|
<div class="nav-panel">
|
|
<p>
|
|
Next: <a href="VLists.html">VLists</a>, Previous: <a href="Bytevectors.html">Bytevectors</a>, Up: <a href="Data-Types.html">Data Types</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|