1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>make-sequence (ANSI and GNU Common Lisp Document)</title>
<meta name="description" content="make-sequence (ANSI and GNU Common Lisp Document)">
<meta name="keywords" content="make-sequence (ANSI and GNU Common Lisp Document)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Sequences-Dictionary.html" rel="up" title="Sequences Dictionary">
<link href="subseq.html" rel="next" title="subseq">
<link href="fill.html" rel="prev" title="fill">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<span id="make_002dsequence"></span><div class="header">
<p>
Next: <a href="subseq.html" accesskey="n" rel="next">subseq</a>, Previous: <a href="fill.html" accesskey="p" rel="prev">fill</a>, Up: <a href="Sequences-Dictionary.html" accesskey="u" rel="up">Sequences Dictionary</a> </p>
</div>
<hr>
<span id="make_002dsequence-_005bFunction_005d"></span><h4 class="subsection">17.3.5 make-sequence [Function]</h4>
<p><code>make-sequence</code> <i>result-type size <span class="roman">&key</span> initial-element</i> ⇒ <i>sequence</i>
</p>
<span id="Arguments-and-Values_003a_003a-357"></span><h4 class="subsubheading">Arguments and Values::</h4>
<p><i>result-type</i>—a <b>sequence</b> <i>type specifier</i>.
</p>
<p><i>size</i>—a non-negative <i>integer</i>.
</p>
<p><i>initial-element</i>—an <i>object</i>.
The default is <i>implementation-dependent</i>.
</p>
<p><i>sequence</i>—a <i>proper sequence</i>.
</p>
<span id="Description_003a_003a-472"></span><h4 class="subsubheading">Description::</h4>
<p>Returns a <i>sequence</i> of the type <i>result-type</i> and of length <i>size</i>,
each of the <i>elements</i> of which has been initialized to <i>initial-element</i>.
</p>
<p>If the <i>result-type</i> is a <i>subtype</i> of <b>list</b>,
the result will be a <i>list</i>.
</p>
<p>If the <i>result-type</i> is a <i>subtype</i> of <b>vector</b>,
then if the implementation can determine the element type specified
for the <i>result-type</i>, the element type of the resulting array
is the result of <i>upgrading</i> that element type; or, if the
implementation can determine that the element type is unspecified (or <tt>*</tt>),
the element type of the resulting array is <b>t</b>;
otherwise, an error is signaled.
</p>
<span id="Examples_003a_003a-339"></span><h4 class="subsubheading">Examples::</h4>
<div class="example">
<pre class="example"> (make-sequence 'list 0) ⇒ ()
(make-sequence 'string 26 :initial-element #\.)
⇒ ".........................."
(make-sequence '(vector double-float) 2
:initial-element 1d0)
⇒ #(1.0d0 1.0d0)
</pre></div>
<div class="example">
<pre class="example"> (make-sequence '(vector * 2) 3) should signal an error
(make-sequence '(vector * 4) 3) should signal an error
</pre></div>
<span id="Affected-By_003a_003a-69"></span><h4 class="subsubheading">Affected By::</h4>
<p>The <i>implementation</i>.
</p>
<span id="Exceptional-Situations_003a_003a-153"></span><h4 class="subsubheading">Exceptional Situations::</h4>
<p>The consequences are unspecified if <i>initial-element</i>
is not an <i>object</i> which can be stored in the resulting <i>sequence</i>.
</p>
<p>An error of <i>type</i> <b>type-error</b> must be signaled if the <i>result-type</i> is neither
a <i>recognizable subtype</i> of <b>list</b>,
nor a <i>recognizable subtype</i> of <b>vector</b>.
</p>
<p>An error of <i>type</i> <b>type-error</b> should be signaled if <i>result-type</i> specifies
the number of elements and <i>size</i> is different from that number.
</p>
<span id="See-Also_003a_003a-384"></span><h4 class="subsubheading">See Also::</h4>
<p><a href="make_002darray.html">make-array</a>
,
<a href="make_002dlist.html">make-list</a>
</p>
<span id="Notes_003a_003a-259"></span><h4 class="subsubheading">Notes::</h4>
<div class="example">
<pre class="example"> (make-sequence 'string 5) ≡ (make-string 5)
</pre></div>
<hr>
<div class="header">
<p>
Next: <a href="subseq.html" accesskey="n" rel="next">subseq</a>, Previous: <a href="fill.html" accesskey="p" rel="prev">fill</a>, Up: <a href="Sequences-Dictionary.html" accesskey="u" rel="up">Sequences Dictionary</a> </p>
</div>
</body>
</html>
|