1
0
Fork 0
cl-sites/guile.html_node/SRFI_002d1-Length-Append-etc.html

141 lines
8.8 KiB
HTML
Raw Normal View History

2024-12-17 12:49:28 +01:00
<!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>SRFI-1 Length Append etc (Guile Reference Manual)</title>
<meta name="description" content="SRFI-1 Length Append etc (Guile Reference Manual)">
<meta name="keywords" content="SRFI-1 Length Append etc (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="SRFI_002d1.html" rel="up" title="SRFI-1">
<link href="SRFI_002d1-Fold-and-Map.html" rel="next" title="SRFI-1 Fold and Map">
<link href="SRFI_002d1-Selectors.html" rel="prev" title="SRFI-1 Selectors">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>
<link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css">
</head>
<body lang="en">
<div class="subsubsection-level-extent" id="SRFI_002d1-Length-Append-etc">
<div class="nav-panel">
<p>
Next: <a href="SRFI_002d1-Fold-and-Map.html" accesskey="n" rel="next">Fold, Unfold &amp; Map</a>, Previous: <a href="SRFI_002d1-Selectors.html" accesskey="p" rel="prev">Selectors</a>, Up: <a href="SRFI_002d1.html" accesskey="u" rel="up">SRFI-1 - List library</a> &nbsp; [<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="subsubsection" id="Length_002c-Append_002c-Concatenate_002c-etc_002e"><span>7.5.3.4 Length, Append, Concatenate, etc.<a class="copiable-link" href="#Length_002c-Append_002c-Concatenate_002c-etc_002e"> &para;</a></span></h4>
<dl class="first-deffn">
<dt class="deffn" id="index-length_002b"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">length+</strong> <var class="def-var-arguments">lst</var><a class="copiable-link" href="#index-length_002b"> &para;</a></span></dt>
<dd><p>Return the length of the argument list <var class="var">lst</var>. When <var class="var">lst</var> is a
circular list, <code class="code">#f</code> is returned.
</p></dd></dl>
<dl class="first-deffn">
<dt class="deffn" id="index-concatenate"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">concatenate</strong> <var class="def-var-arguments">list-of-lists</var><a class="copiable-link" href="#index-concatenate"> &para;</a></span></dt>
<dt class="deffnx def-cmd-deffn" id="index-concatenate_0021"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">concatenate!</strong> <var class="def-var-arguments">list-of-lists</var><a class="copiable-link" href="#index-concatenate_0021"> &para;</a></span></dt>
<dd><p>Construct a list by appending all lists in <var class="var">list-of-lists</var>.
</p>
<p><code class="code">concatenate!</code> may modify the structure of the given lists in
order to produce the result.
</p>
<p><code class="code">concatenate</code> is the same as <code class="code">(apply append
<var class="var">list-of-lists</var>)</code>. It exists because some Scheme implementations
have a limit on the number of arguments a function takes, which the
<code class="code">apply</code> might exceed. In Guile there is no such limit.
</p></dd></dl>
<dl class="first-deffn">
<dt class="deffn" id="index-append_002dreverse"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">append-reverse</strong> <var class="def-var-arguments">rev-head tail</var><a class="copiable-link" href="#index-append_002dreverse"> &para;</a></span></dt>
<dt class="deffnx def-cmd-deffn" id="index-append_002dreverse_0021"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">append-reverse!</strong> <var class="def-var-arguments">rev-head tail</var><a class="copiable-link" href="#index-append_002dreverse_0021"> &para;</a></span></dt>
<dd><p>Reverse <var class="var">rev-head</var>, append <var class="var">tail</var> to it, and return the
result. This is equivalent to <code class="code">(append (reverse <var class="var">rev-head</var>)
<var class="var">tail</var>)</code>, but its implementation is more efficient.
</p>
<div class="example">
<pre class="example-preformatted">(append-reverse '(1 2 3) '(4 5 6)) &rArr; (3 2 1 4 5 6)
</pre></div>
<p><code class="code">append-reverse!</code> may modify <var class="var">rev-head</var> in order to produce
the result.
</p></dd></dl>
<dl class="first-deffn">
<dt class="deffn" id="index-zip"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">zip</strong> <var class="def-var-arguments">lst1 lst2 &hellip;</var><a class="copiable-link" href="#index-zip"> &para;</a></span></dt>
<dd><p>Return a list as long as the shortest of the argument lists, where
each element is a list. The first list contains the first elements of
the argument lists, the second list contains the second elements, and
so on.
</p></dd></dl>
<dl class="first-deffn">
<dt class="deffn" id="index-unzip1"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">unzip1</strong> <var class="def-var-arguments">lst</var><a class="copiable-link" href="#index-unzip1"> &para;</a></span></dt>
<dt class="deffnx def-cmd-deffn" id="index-unzip2"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">unzip2</strong> <var class="def-var-arguments">lst</var><a class="copiable-link" href="#index-unzip2"> &para;</a></span></dt>
<dt class="deffnx def-cmd-deffn" id="index-unzip3"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">unzip3</strong> <var class="def-var-arguments">lst</var><a class="copiable-link" href="#index-unzip3"> &para;</a></span></dt>
<dt class="deffnx def-cmd-deffn" id="index-unzip4"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">unzip4</strong> <var class="def-var-arguments">lst</var><a class="copiable-link" href="#index-unzip4"> &para;</a></span></dt>
<dt class="deffnx def-cmd-deffn" id="index-unzip5"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">unzip5</strong> <var class="def-var-arguments">lst</var><a class="copiable-link" href="#index-unzip5"> &para;</a></span></dt>
<dd><p><code class="code">unzip1</code> takes a list of lists, and returns a list containing the
first elements of each list, <code class="code">unzip2</code> returns two lists, the
first containing the first elements of each lists and the second
containing the second elements of each lists, and so on.
</p></dd></dl>
<dl class="first-deffn">
<dt class="deffn" id="index-count"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">count</strong> <var class="def-var-arguments">pred lst1 lst2 &hellip;</var><a class="copiable-link" href="#index-count"> &para;</a></span></dt>
<dd><p>Return a count of the number of times <var class="var">pred</var> returns true when
called on elements from the given lists.
</p>
<p><var class="var">pred</var> is called with <var class="var">N</var> parameters <code class="code">(<var class="var">pred</var>
<var class="var">elem1</var> &hellip; <var class="var">elemN</var> )</code>, each element being from the
corresponding list. The first call is with the first element of each
list, the second with the second element from each, and so on.
</p>
<p>Counting stops when the end of the shortest list is reached. At least
one list must be non-circular.
</p></dd></dl>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="SRFI_002d1-Fold-and-Map.html">Fold, Unfold &amp; Map</a>, Previous: <a href="SRFI_002d1-Selectors.html">Selectors</a>, Up: <a href="SRFI_002d1.html">SRFI-1 - List library</a> &nbsp; [<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>