9699552002-03-12Martin Nilsson <!doctype html><html><head><title>Pike Reference Manual</title> <meta charset='utf-8'></head>
f6a4222017-07-10Henrik Grubbström (Grubba) <body><dl><dt><h1 class='header'>9. Specific Datatype Modules</h1></dt><dd><dl><dt><h2 class='header'>Module <b class='ms datatype'>String</b></h2> </dt><dd>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>__HAVE_SPRINTF_NEGATIVE_F__</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>constant</code> <code class='datatype'>int</code> String.<code class='constant'>__HAVE_SPRINTF_NEGATIVE_F__</code></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Presence of this symbol indicates that <code>sprintf()</code> supports little endian output for the <tt>'F'</tt>-format specifier.</p>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>sprintf()</code>, <code>lfun::_sprintf()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>__HAVE_SPRINTF_STAR_MAPPING__</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>constant</code> <code class='datatype'>int</code> String.<code class='constant'>__HAVE_SPRINTF_STAR_MAPPING__</code></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Presence of this symbol indicates that <code>sprintf()</code> supports mappings for the <tt>'*'</tt>-modifier syntax.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>sprintf()</code>, <code>lfun::_sprintf()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>capitalize</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>capitalize</span>(</b><code class='datatype'>string</code> <code class='argument'>str</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Convert the first character in <code>str</code> to upper case, and return the new string.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>lower_case()</code>, <code>upper_case()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>common_prefix</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>common_prefix</span>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>) <code class='argument'>strs</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Find the longest common prefix from an array of strings.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>count</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int</code> <b><span class='method'>count</span>(</b><code class='datatype'>string</code> <code class='argument'>haystack</code>, <code class='datatype'>string</code> <code class='argument'>needle</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Count the number of non-overlapping times the string <code>needle</code> occurs in the string <code>haystack</code>. The special cases for the needle <code class='expr'>""</code> is that it occurs one time in the empty string, zero times in a one character string and between every character (length-1) in any other string.</p>
c3fe742003-02-05Martin Nilsson </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>search()</code>, <code>`/()</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>expand_tabs</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>expand_tabs</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>tab_width</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>substitute_tab</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>substitute_space</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>substitute_newline</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Expands tabs in a string to ordinary spaces, according to common tabulation rules.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>fuzzymatch</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int(0..100)</code> <b><span class='method'>fuzzymatch</span>(</b><code class='datatype'>string</code> <code class='argument'>a</code>, <code class='datatype'>string</code> <code class='argument'>b</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>This function compares two strings using a fuzzy matching routine. The higher the resulting value, the better the strings match.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>Array.diff()</code>, <code>Array.diff_compare_table()</code> <code>Array.diff_longest_sequence()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>hex2string</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string(8bit)</code> <b><span class='method'>hex2string</span>(</b><code class='datatype'>string(8bit)</code> <code class='argument'>hex</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Convert a string of hexadecimal digits to binary data. Non-hexadecimal characters will be ignored when between tuples. Eg. "00 00" is ok, but "0 000" isn't.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>string2hex()</code></p>
f228872013-06-17Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>implode_nicely</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>implode_nicely</span>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>|<code class='datatype'>int</code>|<code class='datatype'>float</code>) <code class='argument'>foo</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>separator</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>This function implodes a list of words to a readable string, e.g. <code class='expr'>({"straw","berry","pie"})</code> becomes <code class='expr'>"straw,&nbsp;berry&nbsp;and&nbsp;pie"</code>. If the separator is omitted, the default is <code class='expr'>"and"</code>. If the words are numbers they are converted to strings first.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>`*()</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>int2char</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>int2char</span>(</b><code class='datatype'>int</code> <code class='argument'>x</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Same as sprintf("%c",x);</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>sprintf()</code></p>
f228872013-06-17Martin Nilsson </dd></dl>
4e6acb2014-03-03Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>int2hex</b></span>
4e6acb2014-03-03Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>int2hex</span>(</b><code class='datatype'>int</code> <code class='argument'>x</code><b>)</b></code></p></dd>
4e6acb2014-03-03Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Same as <code class='expr'>sprintf("%x",x);</code>, i.e. returns the integer <code>x</code> in hexadecimal base using lower cased symbols.</p>
4e6acb2014-03-03Henrik Grubbström (Grubba) </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>sprintf()</code></p>
4e6acb2014-03-03Henrik Grubbström (Grubba) </dd></dl>
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>int2roman</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>int2roman</span>(</b><code class='datatype'>int</code> <code class='argument'>m</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Converts the provided integer to a roman integer (i.e. a string).</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>Throws an error if <code>m</code> is outside the range 0 to 10000.</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>int2size</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>int2size</span>(</b><code class='datatype'>int</code> <code class='argument'>size</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Returns the size as a memory size string with suffix, e.g. 43210 is converted into "42.2 kB". To be correct to the latest standards it should really read "42.2 KiB", but we have chosen to keep the old notation for a while. The function knows about the quantifiers kilo, mega, giga, tera, peta, exa, zetta and yotta.</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>levenshtein_distance</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int</code> <b><span class='method'>levenshtein_distance</span>(</b><code class='datatype'>string</code> <code class='argument'>a</code>, <code class='datatype'>string</code> <code class='argument'>b</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>This function calculates the Levenshtein distance between two strings a and b. The Levenshtein distance describes the minimal number of character additions, removals or substitutions to apply to convert a to b.</p> <p> Mathematically, the Levenshtein distance between two strings a, b is given by lev_a,b(|a|,|b|) where</p> <p> lev_a,b(i, j) == max(i, j), if min(i, j) == 0 lev_a,b(i, j) == min( lev_a,b(i, j-1)+1, lev_a,b(i-1, j)+1, lev_a,b(i-1, j-1) + a_i!=b_j ), else</p> <p> Note that the first element in the minimum corresponds to inserting a character to a (or deleting a character from b), the second to deleting a character from a and the third to match or mismatch, depending on whether the respective characters are equal.</p> <p> Example: For example, the Levenshtein distance between "pike" and "bikes" is 2, since the following two edits change one into the other, and there is no way to do it with fewer than two edits: - "pike" -&gt; "bike" (substitute "p" with "b") - "bike" -&gt; "bikes" (add "s" at the end)</p> <p> Note that the cost to compute the Levenshtein distance is roughly proportional to the product of the two string lengths. So this function is usually used to aid in fuzzy string matching, when at least one of the strings is short.</p>
f228872013-06-17Martin Nilsson </dd></dl>
e31eaa2014-10-04Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>normalize_space</b></span>
e31eaa2014-10-04Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>normalize_space</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>whitespace</code><b>)</b></code></p></dd>
e31eaa2014-10-04Henrik Grubbström (Grubba) 
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-s'></span>Parameter <code class='parameter'>s</code></dt> <dd></dd><dd class='body--doc'><p>Is returned after white space in it has been normalised. White space is normalised by stripping leading and trailing white space and replacing sequences of white space characters with a single space.</p>
e31eaa2014-10-04Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-whitespace'></span>Parameter <code class='parameter'>whitespace</code></dt> <dd></dd><dd class='body--doc'><p>Defines what is considered to be white space eligible for normalisation. It has a default value that starts with <code class='expr'>"&nbsp;\t\r\n\v\f"</code> and in addition to that contains all whitespace characters part of Unicode. The first character denotes the character for replacing whitespace sequences.</p>
e31eaa2014-10-04Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Trailing and leading whitespace around \r and \n characters is stripped as well (only useful if they're not in the <code>whitespace</code> set).</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This function is a lot faster with just one argument (i.e. the builtin whitespace set has an optimised code path).</p>
e31eaa2014-10-04Henrik Grubbström (Grubba) </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>range</b></span>
1f918f2002-05-26Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>int</code>) <b><span class='method'>range</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd>
c3fe742003-02-05Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Returns the character range of a string in an array of two elements. The first element contains the lower bound and the second the upper. The precision is only 8 bits, so for wide strings only character blocks are known.</p>
c3fe742003-02-05Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
d961e22013-05-29Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>secure</b></span>
d961e22013-05-29Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>secure</span>(</b><code class='datatype'>string</code> <code class='argument'>str</code><b>)</b></code></p></dd>
d961e22013-05-29Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Marks the string as secure, which will clear the memory area before freeing the string.</p>
d961e22013-05-29Henrik Grubbström (Grubba) </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>Object.secure()</code></p>
d961e22013-05-29Henrik Grubbström (Grubba) </dd></dl>
2ca0cf2014-09-29Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>sillycaps</b></span>
2ca0cf2014-09-29Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>sillycaps</span>(</b><code class='datatype'>string</code> <code class='argument'>str</code><b>)</b></code></p></dd>
2ca0cf2014-09-29Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Convert the first character in each word (separated by spaces) in <code>str</code> to upper case, and return the new string.</p>
2ca0cf2014-09-29Henrik Grubbström (Grubba) </dd></dl>
5465692008-06-13Martin Bähr <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>soundex</b></span>
5465692008-06-13Martin Bähr </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>soundex</span>(</b><code class='datatype'>string</code> <code class='argument'>word</code><b>)</b></code></p></dd>
5465692008-06-13Martin Bähr  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Returns the soundex value of <code>word</code> according to the original Soundex algorithm, patented by Margaret O´Dell and Robert C. Russel in 1918. The method is based on the phonetic classification of sounds by how they are made. It was only intended for hashing of english surnames, and even at that it isn't that much of a help.</p>
5465692008-06-13Martin Bähr </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>status</b></span>
5465692008-06-13Martin Bähr </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>status</span>(</b><code class='datatype'>int</code> <code class='argument'>verbose</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Get string table statistics.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns a string with an ASCII table containing the current string table statistics.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Currently returns the empty string (<code class='expr'>""</code>) if <code>verbose</code> is zero.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The formatting and contents of the result may vary between different versions of Pike.</p> </dd></dl>
5465692008-06-13Martin Bähr 
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>string2hex</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>string2hex</span>(</b><code class='datatype'>string</code> <code class='argument'>data</code>, <code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>uppercase</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Convert a string of binary data to a hexadecimal string.</p>
f228872013-06-17Martin Nilsson </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-uppercase'></span>Parameter <code class='parameter'>uppercase</code></dt> <dd></dd><dd class='body--doc'><p>If set, the string will use upper cased characters.</p>
f228872013-06-17Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>hex2string()</code></p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>trim</b></span>
70bc302014-09-28Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>trim</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Trim leading and trailing white spaces characters (space, tab, newline, carriage return, form feed, vertical tab and all the white spaces defined in Unicode) from the string <code>s</code>.</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>trim_whites</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>trim_whites</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Trim leading and trailing spaces and tabs from the string <code>s</code>.</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>width</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int(8..8)</code>|<code class='datatype'>int(16..16)</code>|<code class='datatype'>int(32..32)</code> <b><span class='method'>width</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Returns the width of a string.</p>
f228872013-06-17Martin Nilsson </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Three return values are currently possible:</p> <table class='box'><tr><td><code><code class='key'>8</code></code></td><td><p>The string <code>s</code> only contains characters &lt;= 255.</p> </td></tr> <tr><td><code><code class='key'>16</code></code></td><td><p>The string <code>s</code> only contains characters &lt;= 65535.</p> </td></tr> <tr><td><code><code class='key'>32</code></code></td><td><p>The string <code>s</code> contains characters &gt;= 65536.</p> </td></tr> </table> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>It is possible that a future version of Pike may return further values. In particular the width <code class='expr'>7</code> seems like it could be useful.</p> </dd></dl> <dl><dt><h2 class='header'>Class <b class='ms datatype'>String.Bootstring</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>This class implements the "Bootstring" string transcoder described in <a href='ftp://ftp.rfc-editor.org/in-notes/rfc3492.txt'>ftp://ftp.rfc-editor.org/in-notes/rfc3492.txt</a>.</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>create</b></span> </dt> <dd><p><code><span class='object'>String.Bootstring</span> <span class='class'>String.Bootstring</span><b>(</b><code class='datatype'>int</code> <code class='argument'>base</code>, <code class='datatype'>int</code> <code class='argument'>tmin</code>, <code class='datatype'>int</code> <code class='argument'>tmax</code>, <code class='datatype'>int</code> <code class='argument'>skew</code>, <code class='datatype'>int</code> <code class='argument'>damp</code>, <code class='datatype'>int</code> <code class='argument'>initial_bias</code>, <code class='datatype'>int</code> <code class='argument'>initial_n</code>, <code class='datatype'>int</code> <code class='argument'>delim</code>, <code class='datatype'>string</code> <code class='argument'>digits</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Creates a Bootstring transcoder instance using the specified parameters.</p>
f228872013-06-17Martin Nilsson </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-base'></span>Parameter <code class='parameter'>base</code></dt> <dd></dd><dd class='body--doc'><p>The base used by the variable-length integers.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-tmin'></span>Parameter <code class='parameter'>tmin</code></dt> <dd></dd><dd class='body--doc'><p>The minimum threshold digit value for the variable-length integers. Must be &gt;=0 and &lt;= tmax.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-tmax'></span>Parameter <code class='parameter'>tmax</code></dt> <dd></dd><dd class='body--doc'><p>The maximum threshold digit value for the variable-length integers. Must be &lt;= base-1.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-skew'></span>Parameter <code class='parameter'>skew</code></dt> <dd></dd><dd class='body--doc'><p>The skew term for the bias adapation. Must be &gt;= 1.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-damp'></span>Parameter <code class='parameter'>damp</code></dt> <dd></dd><dd class='body--doc'><p>The damping factor for the bias adaption. Must be &gt;= 2.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-initial_bias'></span>Parameter <code class='parameter'>initial_bias</code></dt> <dd></dd><dd class='body--doc'><p>The initial bias for the variable-length integer thresholding. initial_bias % base must be &lt;= base - tmin.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-initial_n'></span>Parameter <code class='parameter'>initial_n</code></dt> <dd></dd><dd class='body--doc'><p>The first code point outside the "basic" set of code points.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-delim'></span>Parameter <code class='parameter'>delim</code></dt> <dd></dd><dd class='body--doc'><p>The "basic" code point used as the delimiter.</p>
f228872013-06-17Martin Nilsson </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-digits'></span>Parameter <code class='parameter'>digits</code></dt> <dd></dd><dd class='body--doc'><p>The "basic" code points used as digits. The length of the string should be the same as the base parameter.</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>decode</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>decode</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Decodes a Bootstring encoded string of "basic" code points back to the original string space.</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>encode</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>encode</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Encodes a string using Bootstring encoding into a string constisting only of "basic" code points (&lt; initial_n).</p>
f228872013-06-17Martin Nilsson </dd></dl>
f6a4222017-07-10Henrik Grubbström (Grubba) </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>String.Buffer</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>A buffer, used for building strings. It's conceptually similar to a string, but you can only <code>add</code> strings to it, and you can only <code>get</code> the value from it once.</p> <p> There is a reason for those seemingly rather odd limitations, it makes it possible to do some optimizations that really speed things up.</p> <p> You do not need to use this class unless you add very many strings together, or very large strings.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>For the fastest possible operation, write your code like this:</p> <pre><code><span class='ns'>String</span><span class='delim'>.</span>Buffer b <span class='delim'>=</span> <span class='ns'>String</span><span class='delim'>.</span>Buffer<span class='delim'>(</span> <span class='delim'>)</span><span class='delim'>;</span>
f228872013-06-17Martin Nilsson 
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='type'>function</span> add <span class='delim'>=</span> b-&gt;add<span class='delim'>;</span> .. call add several times in code ... <span class='type'>string</span> result <span class='delim'>=</span> b-&gt;get<span class='delim'>(</span><span class='delim'>)</span><span class='delim'>;</span> <span class='comment'>// also clears the buffer</span> </code></pre></pre></dd></dl>
f228872013-06-17Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>_search</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int(0..)</code> <b><span class='method'>search</span>(</b><span class='class'>String.Buffer</span> <span class='argument'>from</span>, <code class='datatype'>int</code> <code class='argument'>character</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>start</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>end</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Search for a <code>character</code> in the buffer, starting the scan from <code>start</code> and ending at <code>end</code> (inclusive).</p>
f228872013-06-17Martin Nilsson </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns to position in the buffer where the character was found on success, and <code>UNDEFINED</code> on failure.</p>
25eb8a2003-10-05Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>Stdio.Buffer()-&gt;_search()</code>, <code>search()</code>, <code>lfun::_search()</code></p>
5465692008-06-13Martin Bähr </dd></dl>
f6a4222017-07-10Henrik Grubbström (Grubba) 
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>_search</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int(0..)</code> <b><span class='method'>search</span>(</b><span class='class'>String.Buffer</span> <span class='argument'>from</span>, <code class='datatype'>string</code> <code class='argument'>substring</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>start</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>end</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Search for a <code>substring</code> in the buffer, starting the scan from <code>start</code> and ending at <code>end</code> (inclusive).</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns to position in the buffer where the substring was found on success, and <code>UNDEFINED</code> on failure.</p>
f228872013-06-17Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>Stdio.Buffer()-&gt;_search()</code>, <code>search()</code>, <code>lfun::_search()</code></p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>_sizeof</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int</code> <b><span class='method'>sizeof</span>(</b> <span class='class'>String.Buffer</span> <span class='argument'>arg</span> <b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Returns the size of the buffer.</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>_sprintf</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='datatype'>string</span> <b><span class='method'>sprintf</span>(</b><span class='datatype'>string</span> <span class='constant'>format</span>, ... <span class='class'>String.Buffer</span> <span class='constant'>arg</span> ... <b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>It is possible to <code>sprintf</code> a String.Buffer object as <tt>%s</tt> just as if it was a string.</p>
f228872013-06-17Martin Nilsson </dd></dl>
70bc302014-09-28Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`+</b></span> </dt> <dd><p><code><code class='object unresolved'>String.Buffer</code> res = <code class='class'>String.Buffer()</code>&#32;+&#32;<code class='class'>what</code></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`+=</b></span>
70bc302014-09-28Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='class'>String.Buffer()</code>&#32;+=&#32;<code class='class'>what</code></code></p></dd>
70bc302014-09-28Henrik Grubbström (Grubba) </dl>
5465692008-06-13Martin Bähr <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>add</b></span>
5465692008-06-13Martin Bähr </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int</code> <b><span class='method'>add</span>(</b><code class='datatype'>string</code>|<code class='object unresolved'>String.Buffer</code> ... <code class='argument'>data</code><b>)</b></code></p></dd>
5465692008-06-13Martin Bähr  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Adds <code>data</code> to the buffer.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns the size of the buffer.</p>
5465692008-06-13Martin Bähr </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Pike 7.8 and earlier did not support adding <code>String.Buffer</code>s directly.</p>
5465692008-06-13Martin Bähr </dd></dl>
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>cast</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><b>(</b><span class='datatype'>int</span><b>)</b><span class='class'>String.Buffer</span>()<br><b>(</b><span class='datatype'>float</span><b>)</b><span class='class'>String.Buffer</span>()<br><b>(</b><span class='datatype'>string</span><b>)</b><span class='class'>String.Buffer</span>()<br><b>(</b><span class='datatype'>array</span><b>)</b><span class='class'>String.Buffer</span>()<br><b>(</b><span class='datatype'>mapping</span><b>)</b><span class='class'>String.Buffer</span>()<br><b>(</b><span class='datatype'>multiset</span><b>)</b><span class='class'>String.Buffer</span>()</code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>It is possible to cast a String.Buffer object to a <code class='expr'>string</code> and an <code class='expr'>int</code>.</p>
f228872013-06-17Martin Nilsson </dd></dl>
5465692008-06-13Martin Bähr <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>clear</b></span>
5465692008-06-13Martin Bähr </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>void</code> <b><span class='method'>clear</span>(</b><b>)</b></code></p></dd>
5465692008-06-13Martin Bähr  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Empty the buffer, and don't care about the old content.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This function was not available in Pike 7.8 and earlier.</p>
5465692008-06-13Martin Bähr </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>get()</code></p>
5465692008-06-13Martin Bähr </dd></dl>
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>create</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='object'>String.Buffer</span> <span class='class'>String.Buffer</span><b>(</b><code class='datatype'>int</code> <code class='argument'>initial_size</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Initializes a new buffer.</p> <p> If no <code>initial_size</code> is specified, 256 is used. If you know approximately how big the buffer will be, you can optimize the operation of <code>add()</code> (slightly) by passing the size to this function.</p>
f228872013-06-17Martin Nilsson </dd></dl>
b34a222014-09-15Per Hedbor <hr /> <dl class='group--doc'>
70bc302014-09-28Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>get</b></span>
b34a222014-09-15Per Hedbor </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get</span>(</b><b>)</b></code></p></dd>
b34a222014-09-15Per Hedbor  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Get the data from the buffer.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>This will clear the data in the buffer</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>get_copy()</code>, <code>clear()</code></p>
b34a222014-09-15Per Hedbor </dd></dl>
5465692008-06-13Martin Bähr <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>get_copy</b></span>
5465692008-06-13Martin Bähr </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_copy</span>(</b><b>)</b></code></p></dd>
5465692008-06-13Martin Bähr  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Get the data from the buffer. Significantly slower than <code>get</code>, but does not clear the buffer.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>get()</code></p>
5465692008-06-13Martin Bähr </dd></dl>
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>putchar</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>void</code> <b><span class='method'>putchar</span>(</b><code class='datatype'>int</code> <code class='argument'>c</code><b>)</b></code></p></dd>
70bc302014-09-28Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Appends the character <code>c</code> at the end of the string.</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>sprintf</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int</code> <b><span class='method'>sprintf</span>(</b><code class='object unresolved'>strict_sprintf_format</code> <code class='argument'>format</code>, <code class='object unresolved'>sprintf_args</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Appends the output from <code>sprintf</code> at the end of the string. Returns the resulting size of the String.Buffer.</p> </dd></dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>String.Iterator</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>An object of this class is returned by <code>get_iterator()</code> when called with a string.</p>
f228872013-06-17Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>get_iterator</code></p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>predef::Iterator</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='datatype'>inherit predef::Iterator</span> : <span class='inherit'>predef::Iterator</span></code></p></dd> </dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>String.Replace</b></h2> </dt><dd><dl class='group--doc'>
f228872013-06-17Martin Nilsson <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>This is a "compiled" version of the <code>replace</code> function applied on a string, with more than one replace string. The replace strings are given to the create method as a <i>from</i> and <i>to</i> array and are then analyzed. The <code class='expr'>`()</code> is then called with a string and the replace rules in the Replace object will be applied. The Replace object is used internally by the Pike optimizer and need not be used manually.</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>_decode</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='class'>String.Replace</span> <b><span class='method'>decode_value</span>(</b><span class='datatype'>string(8bit)</span> <span class='argument'>data</span>)</b></code></p></dd> </dl>
f228872013-06-17Martin Nilsson 
f6a4222017-07-10Henrik Grubbström (Grubba)  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_encode</b></span> </dt> <dd><p><code><span class='datatype'>string(8bit)</span> <b><span class='method'>encode_value</span>(</b><span class='class'>String.Replace</span> <span class='argument'>data</span>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`()</b></span> </dt> <dd><p><code><code class='datatype'>string</code> res = <code class='class'>String.Replace()</code>()</code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span> </dt> <dd><p><code><span class='object'>String.Replace</span> <span class='class'>String.Replace</span><b>(</b><b>)</b></code><br> <code><span class='object'>String.Replace</span> <span class='class'>String.Replace</span><b>(</b><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>)<b>)</b></code><br> <code><span class='object'>String.Replace</span> <span class='class'>String.Replace</span><b>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>) <code class='argument'>from</code>, <code class='datatype'>array</code>(<code class='datatype'>string</code>)|<code class='datatype'>string</code> <code class='argument'>to</code><b>)</b></code></p></dd> </dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>String.SingleReplace</b></h2>
70bc302014-09-28Henrik Grubbström (Grubba) </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>This is a "compiled" version of the <code>replace</code> function applied on a string, with just one replace string. The replace strings are given to the create method as a <i>from</i> and <i>tom</i> string and are then analyzed. The <code class='expr'>`()</code> is then called with a string and the replace rule in the Replace object will be applied. The Replace object is used internally by the Pike optimizer and need not be used manually.</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>_decode</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='class'>String.SingleReplace</span> <b><span class='method'>decode_value</span>(</b><span class='datatype'>string(8bit)</span> <span class='argument'>data</span>)</b></code></p></dd> </dl>
f228872013-06-17Martin Nilsson 
f6a4222017-07-10Henrik Grubbström (Grubba)  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_encode</b></span> </dt> <dd><p><code><span class='datatype'>string(8bit)</span> <b><span class='method'>encode_value</span>(</b><span class='class'>String.SingleReplace</span> <span class='argument'>data</span>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`()</b></span> </dt> <dd><p><code><code class='datatype'>string</code> res = <code class='class'>String.SingleReplace()</code>()</code></p></dd> </dl>
f228872013-06-17Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>create</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='object'>String.SingleReplace</span> <span class='class'>String.SingleReplace</span><b>(</b><code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>from</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>to</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson 
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>May be called with either zero or two arguments.</p> </dd></dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>String.SplitIterator</b></h2> </dt><dd><dl class='group--doc'>
f228872013-06-17Martin Nilsson <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>An iterator that iterates over substrings of a string, separated by a character or several different characters.</p>
f228872013-06-17Martin Nilsson </dd> <dt class='head--doc'>Note</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Typically you don't need to explicitly use the SplitIterator. Expressions like the following are automatically optimized into using a SplitIterator.</p> <pre><code><span class='lang'>foreach</span><span class='delim'>(</span>str<span class='delim'>/</span><span class='string'>"\n"</span><span class='delim'>,</span> <span class='type'>string</span> line<span class='delim'>)</span> write<span class='delim'>(</span><span class='string'>"%s\n"</span><span class='delim'>,</span> line<span class='delim'>)</span><span class='delim'>;</span> </code></pre></dd></dl>
f228872013-06-17Martin Nilsson 
60c5b22010-11-19Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>create</b></span>
60c5b22010-11-19Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='object'>String.SplitIterator</span> <span class='class'>String.SplitIterator</span><b>(</b><code class='datatype'>string</code> <code class='argument'>buffer</code>, <code class='datatype'>int</code>|<code class='datatype'>array</code>(<code class='datatype'>int</code>)|<code class='datatype'>multiset</code>(<code class='datatype'>int</code>) <code class='argument'>split_set</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>flags</code>, <code class='datatype'>function</code>(:<code class='datatype'>string</code>)|<code class='datatype'>void</code> <code class='argument'>feed</code><b>)</b></code></p></dd>
70bc302014-09-28Henrik Grubbström (Grubba) 
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-buffer'></span>Parameter <code class='parameter'>buffer</code></dt> <dd></dd><dd class='body--doc'><p>The string to split.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-split_set'></span>Parameter <code class='parameter'>split_set</code></dt> <dd></dd><dd class='body--doc'><p>The character or characters to split on.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-flags'></span>Parameter <code class='parameter'>flags</code></dt> <dd></dd><dd class='body--doc'><p>Skip empty elements if set.</p> </dd> <dt class='head--doc'><span id='p-feed'></span>Parameter <code class='parameter'>feed</code></dt> <dd></dd><dd class='body--doc'><p>Callback function that is called once the <code>buffer</code> is used up and the SplitIterator wants more data.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd></dl>
60c5b22010-11-19Henrik Grubbström (Grubba) 
f6a4222017-07-10Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>predef::Iterator</b></span> </dt> <dd><p><code><span class='datatype'>inherit predef::Iterator</span> : <span class='inherit'>predef::Iterator</span></code></p></dd> </dl> </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>String.Elite</b></h2> </dt><dd>
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>elite_string</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>elite_string</span>(</b><code class='datatype'>string</code> <code class='argument'>in</code>, <code class='datatype'>void</code>|<code class='datatype'>int(0..100)</code> <code class='argument'>leetp</code>, <code class='datatype'>void</code>|<code class='datatype'>bool</code> <code class='argument'>eightbit</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Translates a string to 1337. The optional argument leetp is the maximum percentage of leetness (100=max leet, 0=no leet).</p> <p> The translation is performed in three steps, first the neccesary elite translations (picture -&gt; pic, cool-&gt;kewl etc), then optional translations (ok-&gt;k, dude-&gt;dood, -ers -&gt; -orz), then calls elite_word on the resulting words.</p>
f228872013-06-17Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>elite_word</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>elite_word</span>(</b><code class='datatype'>string</code> <code class='argument'>in</code>, <code class='datatype'>void</code>|<code class='datatype'>int(0..100)</code> <code class='argument'>leetp</code>, <code class='datatype'>void</code>|<code class='datatype'>int(0..2)</code> <code class='argument'>eightbit</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Translates one word to 1337. The optional argument leetp is the maximum percentage of leetness (100=max leet, 0=no leet). elite_word only do character-based translation, for instance from "k" to "|&lt;", but no language translation (no "cool" to "kewl").</p> </dd></dl> </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>String.HTML</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Functions that helps generating HTML. All functions generates HTML that is XHTML compliant as well as backwards compatible with old HTML standards in what extent is possible.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>pad_rows</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>string</code>)) <b><span class='method'>pad_rows</span>(</b><code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>string</code>)) <code class='argument'>rows</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>padding</code><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Pads out the rows in a array of rows to equal length. The new elements in the rows will have the value provided in <code>padding</code>, or "&amp;nbsp;".</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>select</b></span>
70bc302014-09-28Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>select</span>(</b><code class='datatype'>string</code> <code class='argument'>name</code>, <code class='datatype'>array</code>(<code class='datatype'>string</code>)|<code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>string</code>)) <code class='argument'>choices</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>selected</code><b>)</b></code></p></dd>
70bc302014-09-28Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Creates an HTML select list.</p>
5465692008-06-13Martin Bähr </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-name'></span>Parameter <code class='parameter'>name</code></dt> <dd></dd><dd class='body--doc'><p>The name of the select list. Will be used in the name attribute of the select element.</p> </dd> <dt class='head--doc'><span id='p-choices'></span>Parameter <code class='parameter'>choices</code></dt> <dd></dd><dd class='body--doc'><p>May either be an array of strings, where each string is a choice, or an array of pairs. A pair is an array with two strings. The first string is the value of the choice while the second string is the presentation text associated with the value.</p> </dd> <dt class='head--doc'><span id='p-selected'></span>Parameter <code class='parameter'>selected</code></dt> <dd></dd><dd class='body--doc'><p>The value that should be selected by default, if any.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>select("language", ({ ({ "eng", "English" }), ({ "swe", "Swedish" }), ({ "nor", "Norwegian" }) }), "swe");</p> </pre></dd></dl>
f228872013-06-17Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>simple_obox</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>simple_obox</span>(</b><code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>string</code>)) <code class='argument'>rows</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>frame_color</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>cell_color</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>width</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>padding</code>, <code class='datatype'>void</code>|<code class='datatype'>function</code>(<code class='datatype'>int</code>, <code class='datatype'>int</code>, <code class='datatype'>string</code>, <code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>cell_callback</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>This function should solve most of the obox needs that arises. It creates a table out of the array of arrays of strings fed into it. The tables will (with default settings) have a thin black outline around the table and between its cells. Much effort has gone into finding a simple HTML reresentation of such obox that is rendered in a similar way in all popular browsers. The current implementation has been tested against IE, Netscape, Mozilla, Opera and Konquest.</p> </dd> <dt class='head--doc'><span id='p-rows'></span>Parameter <code class='parameter'>rows</code></dt> <dd></dd><dd class='body--doc'><p>Simply an array of arrays with strings. The strings are the values that should appear in the table cells. All rows should have equal number of cells, otherwise the result will not be very eye pleasing.</p> </dd> <dt class='head--doc'><span id='p-frame_color'></span>Parameter <code class='parameter'>frame_color</code></dt> <dd></dd><dd class='body--doc'><p>The color of the surrounding frame. Defaults to "#000000".</p> </dd> <dt class='head--doc'><span id='p-cell_color'></span>Parameter <code class='parameter'>cell_color</code></dt> <dd></dd><dd class='body--doc'><p>The background color of the cells. Defaults to "#ffffff".</p> </dd> <dt class='head--doc'><span id='p-width'></span>Parameter <code class='parameter'>width</code></dt> <dd></dd><dd class='body--doc'><p>The border width. Defaults to "1".</p> </dd> <dt class='head--doc'><span id='p-padding'></span>Parameter <code class='parameter'>padding</code></dt> <dd></dd><dd class='body--doc'><p>The amount of padding in each cell. Defaults to "3".</p> </dd> <dt class='head--doc'><span id='p-cell_callback'></span>Parameter <code class='parameter'>cell_callback</code></dt> <dd></dd><dd class='body--doc'><p>If provided, the cell callback will be called for each cell. As in parameters it will get the current x and y coordinates in the table. The upper left cell is 0,0. In addition to the coordinates it will also receive the background color and the contents of the current cell. It is expected to return a td-element.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>function cb = lambda(int x, int y, string bgcolor, string contents) { if(y%2) return "&lt;td bgcolor='#aaaaff'&gt;"+contents+"&lt;/td&gt;"; return "&lt;td bgcolor='"+bgcolor+"'&gt;"+contents+"&lt;/td&gt;"; } simple_obox(my_rows, "#0000a0", 0, "1", "3", cb);</p> </pre></dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>pad_rows</code></p> </dd></dl> <dl><dt><h2 class='header'>Class <b class='ms datatype'>String.HTML.OBox</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Provides the same functionality as the <code>simple_obox</code> function, in a "streaming" way. The real gain is different addtition methods as well as the possibility to change the cell callback at any time.</p>
f228872013-06-17Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>simple_obox</p>
5465692008-06-13Martin Bähr </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>add_cell</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>void</code> <b><span class='method'>add_cell</span>(</b><code class='datatype'>string</code> <code class='argument'>contents</code><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Adds a cell with the provided content.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>add_raw_cell</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>void</code> <b><span class='method'>add_raw_cell</span>(</b><code class='datatype'>string</code> <code class='argument'>cell</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Adds this cell to the table unmodified, e.g. it should have an enclosing td or th element.</p>
f228872013-06-17Martin Nilsson </dd></dl>
2326c02014-09-03Per Hedbor <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>add_row</b></span>
2326c02014-09-03Per Hedbor </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>void</code> <b><span class='method'>add_row</span>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>) <code class='argument'>cells</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Adds a complete row. If the current row is nonempty a new row will be started.</p> </dd></dl>
2326c02014-09-03Per Hedbor 
f7261b2009-04-25Martin Stjernholm <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>add_tagdata_cell</b></span>
f7261b2009-04-25Martin Stjernholm </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>void</code> <b><span class='method'>add_tagdata_cell</span>(</b><code class='datatype'>string</code> <code class='argument'>tag</code>, <code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>args</code>, <code class='datatype'>string</code> <code class='argument'>contents</code><b>)</b></code></p></dd>
f7261b2009-04-25Martin Stjernholm  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Creates a cell from the provided arguments and adds it to the table.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-tag'></span>Parameter <code class='parameter'>tag</code></dt> <dd></dd><dd class='body--doc'><p>The name of the element that should be produces. Typically "td" or "th".</p>
f7261b2009-04-25Martin Stjernholm </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-args'></span>Parameter <code class='parameter'>args</code></dt> <dd></dd><dd class='body--doc'><p>A mapping with the elements attributes.</p> </dd> <dt class='head--doc'><span id='p-contents'></span>Parameter <code class='parameter'>contents</code></dt> <dd></dd><dd class='body--doc'><p>The element contents.</p>
f7261b2009-04-25Martin Stjernholm </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>cast</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><b>(</b><span class='datatype'>int</span><b>)</b><span class='class'>String.HTML.OBox</span>()<br><b>(</b><span class='datatype'>float</span><b>)</b><span class='class'>String.HTML.OBox</span>()<br><b>(</b><span class='datatype'>string</span><b>)</b><span class='class'>String.HTML.OBox</span>()<br><b>(</b><span class='datatype'>array</span><b>)</b><span class='class'>String.HTML.OBox</span>()<br><b>(</b><span class='datatype'>mapping</span><b>)</b><span class='class'>String.HTML.OBox</span>()<br><b>(</b><span class='datatype'>multiset</span><b>)</b><span class='class'>String.HTML.OBox</span>()</code></p></dd>
c3fe742003-02-05Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>It is possible to case this object to a string, which does the same as calling <code>render</code>, and to an array, which returns the cells in an array of rows.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>create</b></span> </dt> <dd><p><code><span class='object'>String.HTML.OBox</span> <span class='class'>String.HTML.OBox</span><b>(</b><code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>frame_color</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>cell_color</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>width</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>padding</code>, <code class='datatype'>void</code>|<code class='datatype'>function</code>(<code class='datatype'>int</code>, <code class='datatype'>int</code>, <code class='datatype'>string</code>, <code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>cell_callback</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>new_row</b></span>
70bc302014-09-28Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>void</code> <b><span class='method'>new_row</span>(</b><b>)</b></code></p></dd>
70bc302014-09-28Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Begin a new row. Succeeding cells will be added to this row instead of the current.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd></dl>
f03c622015-05-18Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>pad_rows</b></span>
f03c622015-05-18Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>void</code> <b><span class='method'>pad_rows</span>(</b><b>)</b></code></p></dd>
f03c622015-05-18Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Ensures that all rows have the same number of cells.</p>
f03c622015-05-18Henrik Grubbström (Grubba) </dd></dl>
70bc302014-09-28Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>render</b></span>
70bc302014-09-28Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>render</span>(</b><b>)</b></code></p></dd>
70bc302014-09-28Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Returns the result.</p>
c3fe742003-02-05Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>set_cell_callback</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_cell_callback</span>(</b><code class='datatype'>function</code>(<code class='datatype'>int</code>, <code class='datatype'>int</code>, <code class='datatype'>string</code>, <code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>cell_callback</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_extra_args</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_extra_args</span>(</b><code class='datatype'>array</code>(<code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>)) <code class='argument'>extra_args</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>The argument in the mappings will be added to the cell in the cooresponding column of the table.</p>
f228872013-06-17Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>set_extra_args</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_extra_args</span>(</b><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>extra_args</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>The argument in the mapping will be added to all created table cells.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd></dl>
f6a4222017-07-10Henrik Grubbström (Grubba) </dd></dl></dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Array</b></h2>
70bc302014-09-28Henrik Grubbström (Grubba) </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>General functions to operate on arrays.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd></dl> <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>all</b></span>
70bc302014-09-28Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>all</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code>, <code class='datatype'>function</code>(<code class='datatype'>int(0..0)</code>, <code class='datatype'>mixed</code> ... :<code class='datatype'>mixed</code>) <code class='argument'>predicate</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extra_args</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns 1 if all of the elements in <code>a</code> fulfills the requirement <code>predicate</code>( <code>a</code>[<i>i</i>], @<code>extra_args</code> ), otherwise 0. The predicate should return non-zero for an element that meets the requirements and zero for those that do not.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>Array.all( ({ 2, 4, 6, 8 }), `&lt;, 17 )</p> </pre></dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>any</code>, <code>has_value</code></p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd></dl>
f228872013-06-17Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>any</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>any</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code>, <code class='datatype'>function</code>(<code class='datatype'>int(0..0)</code>, <code class='datatype'>mixed</code> ... :<code class='datatype'>mixed</code>) <code class='argument'>predicate</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extra_args</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Returns 1 if any of the elements in <code>a</code> fulfills the requirement <code>predicate</code>( <code>a</code>[<i>i</i>], @<code>extra_args</code> ), otherwise 0. The predicate should return non-zero for an element that meets the requirements and zero for those that do not.</p>
f228872013-06-17Martin Nilsson </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>Array.any( ({ 2, 4, 6, 8 }), `&gt;, 5 )</p> </pre></dd>
f228872013-06-17Martin Nilsson <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>all</code>, <code>has_value</code></p>
f228872013-06-17Martin Nilsson </dd></dl>
45eff82002-06-11Johan Sundström <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>arrayify</b></span>
45eff82002-06-11Johan Sundström </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code> <b><span class='method'>arrayify</span>(</b><code class='datatype'>void</code>|<code class='datatype'>array</code>|<code class='datatype'>mixed</code> <code class='argument'>x</code><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström 
50af352002-07-15Martin Nilsson <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Make an array of the argument, if it isn't already. An undefined argument gives the empty array. This is useful when something is either an array or a basic datatype, for instance in headers from the MIME module or Protocols.HTTP.Server.</p>
afee992015-10-13Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-x'></span>Parameter <code class='parameter'>x</code></dt> <dd></dd><dd class='body--doc'><p>Result depends of the argument type:</p> <dl class='group--doc'><dt>arrayp(x)</dt> <dd><p>arrayify(x) =&gt; x</p>
afee992015-10-13Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt>undefinedp(x)</dt> <dd><p>arrayify(x) =&gt; ({})</p>
0f4adf2003-07-22Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt>otherwise</dt> <dd><p>arrayify(x) =&gt; ({ x })</p>
c3fe742003-02-05Martin Nilsson </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) </dl>
c3fe742003-02-05Martin Nilsson </dd></dl>
45eff82002-06-11Johan Sundström 
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>columns</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>) <b><span class='method'>columns</span>(</b><code class='datatype'>array</code> <code class='argument'>x</code>, <code class='datatype'>array</code> <code class='argument'>ind</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Get multiple columns from an array.</p> <p> This function is equvivalent to <pre> map(ind, lambda(mixed i) { return column(x, i); }) </pre></p>
f228872013-06-17Martin Nilsson </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>column()</code></p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>combinations</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>) <b><span class='method'>combinations</span>(</b><code class='datatype'>array</code> <code class='argument'>arr</code>, <code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Returns an array of all combinations of length <code>len</code> of elements from <code>arr</code>.</p>
f228872013-06-17Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>permute()</code></p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>common_prefix</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code> <b><span class='method'>common_prefix</span>(</b><code class='datatype'>array</code>(<code class='datatype'>array</code>) <code class='argument'>arrs</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Find the longest common prefix from an array of arrays.</p>
f228872013-06-17Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>String.common_prefix</code></p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>compact_diff3</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>array</code>)) <b><span class='method'>compact_diff3</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code>, <code class='datatype'>array</code> <code class='argument'>b</code>, <code class='datatype'>array</code> <code class='argument'>old</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Given three arrays like those returned from <code>diff3</code>, this function "compacts" the diff3 result by removing all differences where <tt>a</tt> and <tt>b</tt> agrees against <tt>old</tt>. The result is on the same form as the result from <code>diff</code>, and doesn't include the sequence from <tt>old</tt>.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>count</b></span>
70bc302014-09-28Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int</code> <b><span class='method'>count</span>(</b><code class='datatype'>array</code>|<code class='datatype'>mapping</code>|<code class='datatype'>multiset</code> <code class='argument'>haystack</code>, <code class='datatype'>mixed</code> <code class='argument'>needle</code><b>)</b></code><br> <code><code class='datatype'>mapping</code>(<code class='datatype'>mixed</code>:<code class='datatype'>int</code>) <b><span class='method'>count</span>(</b><code class='datatype'>array</code>|<code class='datatype'>mapping</code>|<code class='datatype'>multiset</code> <code class='argument'>haystack</code><b>)</b></code></p></dd>
70bc302014-09-28Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Returns the number of occurrences of <code>needle</code> in <code>haystack</code>. If the optional <code>needle</code> argument is omitted, <code>count</code> instead works similar to the unix command <tt>sort|uniq -c</tt>, returning a mapping with the number of occurrences of each element in <code>haystack</code>. For array or mapping <code>haystack</code>s, it's the values that are counted, for multisets the indices, as you'd expect.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>String.count</code>, <code>search</code>, <code>has_value</code></p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>diff</b></span>
70bc302014-09-28Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>array</code>)) <b><span class='method'>diff</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code>, <code class='datatype'>array</code> <code class='argument'>b</code><b>)</b></code></p></dd>
70bc302014-09-28Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Calculates which parts of the arrays that are common to both, and which parts that are not.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns an array with two elements, the first is an array of parts in array <code>a</code>, and the second is an array of parts in array <code>b</code>.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>diff_compare_table()</code>, <code>diff_longest_sequence()</code>, <code>String.fuzzymatch()</code></p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>diff3</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>array</code>)) <b><span class='method'>diff3</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code>, <code class='datatype'>array</code> <code class='argument'>b</code>, <code class='datatype'>array</code> <code class='argument'>c</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Return the three-way difference between the arrays.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>Array.diff()</code>, <code>Array.diff_longest_sequence()</code></p>
f228872013-06-17Martin Nilsson </dd></dl>
70bc302014-09-28Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>diff_compare_table</b></span>
70bc302014-09-28Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>int</code>)) <b><span class='method'>diff_compare_table</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code>, <code class='datatype'>array</code> <code class='argument'>b</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns an array which maps from index in <code>a</code> to corresponding indices in <code>b</code>.</p> <p> <pre> &gt; Array.diff_compare_table( ({ "a","b","c" }), ({ "b", "b", "c", "d", "b" })); Result: ({ ({ }), ({ 0, 1, 4 }), ({ 2 }) }) </pre></p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>diff()</code>, <code>diff_longest_sequence()</code>, <code>String.fuzzymatch()</code></p> </dd></dl>
70bc302014-09-28Henrik Grubbström (Grubba) 
c3fe742003-02-05Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>diff_dyn_longest_sequence</b></span>
c3fe742003-02-05Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>int</code>) <b><span class='method'>diff_dyn_longest_sequence</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code>, <code class='datatype'>array</code> <code class='argument'>b</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Gives the longest sequence of indices in <code>b</code> that have corresponding values in the same order in <code>a</code>.</p> <p> This function performs the same operation as <code>diff_longest_sequence()</code>, but uses a different algorithm, which in some rare cases might be faster (usually it's slower though).</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>diff_longest_sequence()</code>, <code>diff()</code>, <code>diff_compare_table()</code>, <code>String.fuzzymatch()</code></p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>diff_longest_sequence</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>int</code>) <b><span class='method'>diff_longest_sequence</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code>, <code class='datatype'>array</code> <code class='argument'>b</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Gives the longest sequence of indices in <code>b</code> that have corresponding values in the same order in <code>a</code>.</p>
f228872013-06-17Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>diff()</code>, <code>diff_compare_table()</code>, <code>String.fuzzymatch()</code></p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>dwim_sort_func</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int(-1..1)</code> <b><span class='method'>dwim_sort_func</span>(</b><code class='datatype'>string</code> <code class='argument'>a</code>, <code class='datatype'>string</code> <code class='argument'>b</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Sort without respect to number formatting (most notably leading zeroes).</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>everynth</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>mixed</code>) <b><span class='method'>everynth</span>(</b><code class='datatype'>array</code>(<code class='datatype'>mixed</code>) <code class='argument'>a</code>, <code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>n</code>, <code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>start</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Return an array with every <code>n</code>:th element of the array <code>a</code>.</p> <p> If <code>n</code> is zero every other element will be returned.</p>
f228872013-06-17Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>splice()</code>, <code>`/()</code></p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>flatten</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code> <b><span class='method'>flatten</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code>, <code class='datatype'>mapping</code>(<code class='datatype'>array</code>:<code class='datatype'>array</code>)|<code class='datatype'>void</code> <code class='argument'>state</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Flatten a multi-dimensional array to a one-dimensional array.</p>
4ac5952016-07-20Henrik Grubbström (Grubba) </dd> <dt class='head--doc'>Note</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Prior to Pike 7.5.7 it was not safe to call this function with cyclic data-structures.</p>
f228872013-06-17Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>greedy_diff</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>array</code>)) <b><span class='method'>greedy_diff</span>(</b><code class='datatype'>array</code> <code class='argument'>from</code>, <code class='datatype'>array</code> <code class='argument'>to</code><b>)</b></code></p></dd>
f228872013-06-17Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Like <code>Array.diff</code>, but tries to generate bigger continuous chunks of the differences, instead of maximizing the number of difference chunks. More specifically, <code>greedy_diff</code> optimizes the cases where <code>Array.diff</code> returns <code class='expr'>({&nbsp;...,&nbsp;A,&nbsp;Z,&nbsp;B,&nbsp;({}),&nbsp;C,&nbsp;...&nbsp;})</code> <code class='expr'>({&nbsp;...,&nbsp;A,&nbsp;X,&nbsp;B,&nbsp;&nbsp;Y+B,&nbsp;C,&nbsp;...&nbsp;})</code> into the somewhat shorter diff arrays <code class='expr'>({&nbsp;...,&nbsp;A,&nbsp;Z,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;B+C,&nbsp;...&nbsp;})</code> <code class='expr'>({&nbsp;...,&nbsp;A,&nbsp;X+B+Y,&nbsp;B+C,&nbsp;...&nbsp;})</code></p>
f228872013-06-17Martin Nilsson </dd></dl>
b34a222014-09-15Per Hedbor <hr /> <dl class='group--doc'>
70bc302014-09-28Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>interleave_array</b></span>
b34a222014-09-15Per Hedbor </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>int</code>) <b><span class='method'>interleave_array</span>(</b><code class='datatype'>array</code>(<code class='datatype'>mapping</code>(<code class='datatype'>int</code>:<code class='datatype'>mixed</code>)) <code class='argument'>tab</code><b>)</b></code></p></dd>
b34a222014-09-15Per Hedbor  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Interleave a sparse matrix.</p> <p> Returns an array with offsets that describe how to shift the rows of <code>tab</code> so that only at most one non-zero value exists in every column.</p>
b34a222014-09-15Per Hedbor </dd></dl>
f228872013-06-17Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>longest_ordered_sequence</b></span>
f228872013-06-17Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>int</code>) <b><span class='method'>longest_ordered_sequence</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code><b>)</b></code></p></dd>
70bc302014-09-28Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Find the longest ordered sequence of elements.</p> <p> This function returns an array of the indices in the longest ordered sequence of elements in the array.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>diff()</code></p>
45eff82002-06-11Johan Sundström </dd></dl>
70bc302014-09-28Henrik Grubbström (Grubba) 
45eff82002-06-11Johan Sundström <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>lyskom_sort_func</b></span>
45eff82002-06-11Johan Sundström </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int(-1..1)</code> <b><span class='method'>lyskom_sort_func</span>(</b><code class='datatype'>string</code> <code class='argument'>a</code>, <code class='datatype'>string</code> <code class='argument'>b</code><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Sort comparison function that does not care about case, nor about the contents of any parts of the string enclosed with '()'</p> <p> Example: "Foo (bar)" is given the same weight as "foo (really!)"</p>
45eff82002-06-11Johan Sundström </dd></dl>
84d5df2002-09-16Johan Schön <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>oid_sort_func</b></span>
84d5df2002-09-16Johan Schön </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int(-1..1)</code> <b><span class='method'>oid_sort_func</span>(</b><code class='datatype'>string</code> <code class='argument'>a</code>, <code class='datatype'>string</code> <code class='argument'>b</code><b>)</b></code></p></dd>
84d5df2002-09-16Johan Schön  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Sort with care of numerical sort for OID values, e.g. "1.2.1" before "1.11.1".</p>
c3fe742003-02-05Martin Nilsson </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Returns</dt> <dd class='body--doc'><table class='box'><tr><td><code><code class='key'>-1</code></code></td><td><p><code class='expr'>a&lt;b</code></p> </td></tr> <tr><td><code><code class='key'>0</code></code></td><td><p><code class='expr'>a==b</code></p> </td></tr> <tr><td><code><code class='key'>1</code></code></td><td><p><code class='expr'>a&gt;b</code></p> </td></tr> </table></dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>Note</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>In Pike 7.6 and older this function returned <code class='expr'>0</code> both when <code class='expr'>a&lt;b</code> and <code class='expr'>a==b</code>.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>sort_array</code></p>
84d5df2002-09-16Johan Schön </dd></dl>
45eff82002-06-11Johan Sundström <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>partition</b></span>
45eff82002-06-11Johan Sundström </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>) <b><span class='method'>partition</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code>, <code class='datatype'>function</code>(<code class='datatype'>int(0..0)</code>, <code class='datatype'>mixed</code> ... :<code class='datatype'>mixed</code>) <code class='argument'>arbiter</code>, <code class='datatype'>mixed</code> ... <code class='argument'>extra_args</code><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Splits an array in two, according to an arbitration function <code>arbiter</code>. The elements in <code>a</code> who return non-zero for the expression <code>arbiter</code>( <code>a</code>[<i>i</i>], @<code>extra_args</code> ) end up in the first sub-array, the others in the second. The order is preserved from the original array.</p>
da06012008-12-09Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>Array.partition( enumerate( 9 ), lambda(int n) { return n&gt;3 &amp;&amp; n&lt;7; } ); &gt; ({ ({ 4, 5, 6 }), ({ 0, 1, 2, 3, 7, 8 }) })</p> </pre></dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>filter</code>, <code>`/</code>, <code>`%</code></p>
45eff82002-06-11Johan Sundström </dd></dl> <hr /> <dl class='group--doc'>
70bc302014-09-28Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>permute</b></span>
45eff82002-06-11Johan Sundström </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code> <b><span class='method'>permute</span>(</b><code class='datatype'>array</code> <code class='argument'>in</code>, <code class='datatype'>int(0..)</code> <code class='argument'>number</code><b>)</b></code></p></dd>
70bc302014-09-28Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Give a specified permutation of an array.</p> <p> The number of permutations is equal to <code class='expr'>sizeof(<code>in</code>)!</code> (the factorial of the size of the given array).</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>shuffle()</code></p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd></dl>
e4e3f32002-04-06Martin Nilsson 
50af352002-07-15Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>pop</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code> <b><span class='method'>pop</span>(</b><code class='datatype'>array</code> <code class='argument'>list</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Pops and returns the last value of the array, shortening the array by one element. If there are no elements in the array then 0 is returned otherwise an array is returned where the first returned element is the popped value, and the second element is the modified array.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>Array.pop(({ "a", "b", "c", "d" })); &gt; ({ "d", ({ "a", "b", "c" }) })</p> </pre></dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>ADT.Stack</code>, <code>ADT.Stack.pop</code>, <code>ADT.Stack.quick_pop</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
ab1f522003-07-10Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>push</b></span>
ab1f522003-07-10Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code> <b><span class='method'>push</span>(</b><code class='datatype'>array</code> <code class='argument'>list</code>, <code class='datatype'>mixed</code> <code class='argument'>element</code><b>)</b></code></p></dd>
ab1f522003-07-10Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Threats an Array as a stack and pushes the element onto the end.</p>
da06012008-12-09Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>Array.push(({ "a", "b", "c", "d" }), "e"); &gt; ({ "a", "b", "c", "d", "e" })</p> </pre></dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>ADT.Stack</code>, <code>ADT.Stack.push</code></p>
ab1f522003-07-10Henrik Grubbström (Grubba) </dd></dl>
f6a4222017-07-10Henrik Grubbström (Grubba) 
ab1f522003-07-10Henrik Grubbström (Grubba) 
f7707e2008-03-07Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>reduce</b></span>
f7707e2008-03-07Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>reduce</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>fun</code>, <code class='datatype'>array</code> <code class='argument'>arr</code>, <code class='datatype'>mixed</code>|<code class='datatype'>void</code> <code class='argument'>zero</code><b>)</b></code></p></dd>
f7707e2008-03-07Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>reduce()</code> sends the first two elements in <code>arr</code> to <code>fun</code>, then the result and the next element in <code>arr</code> to <code>fun</code> and so on. Then it returns the result. The function will return <code>zero</code> if <code>arr</code> is the empty array. If <code>arr</code> has only one element, that element will be returned.</p>
f7707e2008-03-07Henrik Grubbström (Grubba) </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>rreduce()</code></p>
f7707e2008-03-07Henrik Grubbström (Grubba) </dd></dl>
0f4adf2003-07-22Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>rreduce</b></span>
0f4adf2003-07-22Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>rreduce</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>fun</code>, <code class='datatype'>array</code> <code class='argument'>arr</code>, <code class='datatype'>mixed</code>|<code class='datatype'>void</code> <code class='argument'>zero</code><b>)</b></code></p></dd>
0f4adf2003-07-22Henrik Grubbström (Grubba)  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>rreduce()</code> sends the last two elements in <code>arr</code> to <code>fun</code>, then the third last element in <code>arr</code> and the result to <code>fun</code> and so on. Then it returns the result. The function will return <code>zero</code> if <code>arr</code> is the empty array. If <code>arr</code> has only one element, that element will be returned.</p>
0f4adf2003-07-22Henrik Grubbström (Grubba) </dd>
16892e2014-05-26Martin Nilsson <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>reduce()</code></p>
0f4adf2003-07-22Henrik Grubbström (Grubba) </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>search_array</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int</code> <b><span class='method'>search_array</span>(</b><code class='datatype'>array</code> <code class='argument'>arr</code>, <code class='datatype'>string</code>|<code class='datatype'>function</code>(:<code class='datatype void'>void</code>)|<code class='datatype'>int</code> <code class='argument'>fun</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>search_array()</code> works like <code>map()</code>, only it returns the index of the first call that returnes true instead.</p> <p> If no call returns true, -1 is returned.</p>
c3fe742003-02-05Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>sum()</code>, <code>map()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>shift</b></span>
1f918f2002-05-26Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code> <b><span class='method'>shift</span>(</b><code class='datatype'>array</code> <code class='argument'>list</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down. If there are no elements in the array it returns 0. Returns an array where the first element is the shifted value and the second element is the modified array.</p>
c3fe742003-02-05Martin Nilsson </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>Array.shift(({ "a", "b", "c", "d"})); &gt; ({ "a", ({ "b", "c", "d" }) })</p> </pre></dd>
c3fe742003-02-05Martin Nilsson <dt class='head--doc'>See also</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>ADT.Stack</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>shuffle</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code> <b><span class='method'>shuffle</span>(</b><code class='datatype'>array</code> <code class='argument'>arr</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p><code>shuffle()</code> gives back the same elements, but in random order. The array is modified destructively.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>permute()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
f6a4222017-07-10Henrik Grubbström (Grubba) 
429e502008-07-12Stephen R. van den Berg <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>sort_array</b></span>
429e502008-07-12Stephen R. van den Berg </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code> <b><span class='method'>sort_array</span>(</b><code class='datatype'>array</code> <code class='argument'>arr</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>)|<code class='datatype'>void</code> <code class='argument'>cmp</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
429e502008-07-12Stephen R. van den Berg  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>This function sorts the array <code>arr</code> after a compare-function <code>cmp</code> which takes two arguments and should return <code class='expr'>1</code> if the first argument is larger then the second. Returns the sorted array - <code>arr</code> is not sorted destructively.</p> <p> The remaining arguments <code>args</code> will be sent as 3rd, 4th etc. argument to <code>cmp</code>.</p> <p> If <code>cmp</code> is omitted, <code>`&gt;()</code> is used instead.</p>
b4418a2008-07-14Stephen R. van den Berg </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>map()</code>, <code>sort()</code>, <code>`&gt;()</code>, <code>dwim_sort_func</code>, <code>lyskom_sort_func</code>, <code>oid_sort_func</code></p>
429e502008-07-12Stephen R. van den Berg </dd></dl>
f6a4222017-07-10Henrik Grubbström (Grubba) 
70bc302014-09-28Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>splice</b></span>
70bc302014-09-28Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>mixed</code>) <b><span class='method'>splice</span>(</b><code class='datatype'>array</code>(<code class='datatype'>mixed</code>) <code class='argument'>arr1</code>, <code class='datatype'>array</code>(<code class='datatype'>mixed</code>) <code class='argument'>arr2</code>, <code class='datatype'>array</code>(<code class='datatype'>mixed</code>) ... <code class='argument'>more_arrays</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Splice two or more arrays.</p> <p> This means that the returned array has the first element in the first given array, then the first argument in next array and so on for all arrays. Then the second elements are added, etc.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>`/()</code>, <code>`*()</code>, <code>`+()</code>, <code>`-()</code>, <code>everynth()</code></p> </dd></dl>
70bc302014-09-28Henrik Grubbström (Grubba) 
429e502008-07-12Stephen R. van den Berg 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>sum</b></span>
1f918f2002-05-26Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>sum</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Sum the elements of an array using `+. The empty array results in 0.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson 
70bc302014-09-28Henrik Grubbström (Grubba)  <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>sum_arrays</b></span>
70bc302014-09-28Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code> <b><span class='method'>sum_arrays</span>(</b><code class='datatype'>function</code>(<code class='datatype'>int(0..0)</code> ... :<code class='datatype'>mixed</code>) <code class='argument'>sum</code>, <code class='datatype'>array</code> ... <code class='argument'>args</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Applies the function <code>sum</code> columnwise on the elements in the provided arrays. E.g. <code class='expr'>sum_array(`+,a,b,c)</code> does the same as <code class='expr'>`+(a[*],b[*],c[*])</code>.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>transpose</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>) <b><span class='method'>transpose</span>(</b><code class='datatype'>array</code>(<code class='datatype'>array</code>) <code class='argument'>matrix</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Takes an array of equally sized arrays (essentially a matrix of size M*N) and returns the transposed (N*M) version of it, where rows and columns are exchanged for one another.</p>
c3fe742003-02-05Martin Nilsson </dd></dl>
f6a4222017-07-10Henrik Grubbström (Grubba)  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>uniq</b></span> </dt> <dd><p><code><code class='datatype'>array</code> <b><span class='method'>uniq</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code><b>)</b></code></p></dd>
70bc302014-09-28Henrik Grubbström (Grubba) <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Remove elements that are duplicates.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>This function returns an copy of the array <code>a</code> with all duplicate values removed. The order of the values is kept in the result; it's always the first of several equal elements that is kept.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Elements are compared with <code>`==</code>. They are also hashed (see <code>lfun::__hash</code> for further details if the array contains objects).</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
f6a4222017-07-10Henrik Grubbström (Grubba) 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>uniq2</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code> <b><span class='method'>uniq2</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Perform the same action as the Unix uniq command on an array, that is, fold consecutive occurrences of the same element into a single element of the result array:</p> <p> aabbbcaababb -&gt; abcabab.</p> <p> See also the <code>uniq</code> function.</p> </dd></dl>
9699552002-03-12Martin Nilsson 
2d83192003-10-30Martin Stjernholm <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>unshift</b></span>
2d83192003-10-30Martin Stjernholm </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>array</code> <b><span class='method'>unshift</span>(</b><code class='datatype'>array</code> <code class='argument'>list</code>, <code class='datatype'>mixed</code> <code class='argument'>element</code><b>)</b></code></p></dd>
2d83192003-10-30Martin Stjernholm 
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Does the opposite of "shift". Or the opposite of a "push", depending on how you look at it. Prepends the element to the front of the array and returns the new array.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>Array.unshift(({ "b", "c", "d" }), "a"); &gt; ({ "a", "b", "c", "d" })</p> </pre></dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>ADT.Stack</code></p> </dd></dl> <dl><dt><h2 class='header'>Class <b class='ms datatype'>Array.Iterator</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>An object of this class is returned by <code>get_iterator()</code> when called with an array.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>get_iterator</code></p> </dd></dl>
2d83192003-10-30Martin Stjernholm 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
70bc302014-09-28Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Inherit</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>predef::Iterator</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='datatype'>inherit predef::Iterator</span> : <span class='inherit'>predef::Iterator</span></code></p></dd>
70bc302014-09-28Henrik Grubbström (Grubba) </dl>
f6a4222017-07-10Henrik Grubbström (Grubba) </dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Mapping</b></h2> </dt><dd>
e4e3f32002-04-06Martin Nilsson 
4856ea2004-05-13H. William Welliver III <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>delete</b></span>
4856ea2004-05-13H. William Welliver III </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>constant</code> Mapping.<code class='constant'>delete</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Alias for <code>m_delete()</code></p>
4856ea2004-05-13H. William Welliver III </dd></dl>
f6a4222017-07-10Henrik Grubbström (Grubba) <dl><dt><h2 class='header'>Class <b class='ms datatype'>Mapping.Iterator</b></h2>
70bc302014-09-28Henrik Grubbström (Grubba) </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>An object of this class is returned by <code>get_iterator()</code> when called with a mapping.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>get_iterator</code></p> </dd></dl>
4856ea2004-05-13H. William Welliver III 
e0c2812004-04-04Martin Stjernholm <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>predef::Iterator</b></span>
e0c2812004-04-04Martin Stjernholm </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='datatype'>inherit predef::Iterator</span> : <span class='inherit'>predef::Iterator</span></code></p></dd> </dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Mapping.ShadowedMapping</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>A mapping look-alike that overrides (ie shadows) another <code>parent</code> mapping.</p> <p> The class implements most of the usual mapping operations.</p>
e0c2812004-04-04Martin Stjernholm </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
c3fe742003-02-05Martin Nilsson <span class='homogen--name'><b>create</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='object'>Mapping.ShadowedMapping</span> <span class='class'>Mapping.ShadowedMapping</span><b>(</b><code class='datatype'>mapping</code>|<code class='object unresolved'>ShadowedMapping</code> <code class='argument'>parent</code>, <code class='datatype'>mapping</code>|<code class='datatype'>void</code> <code class='argument'>shadow</code>, <code class='datatype'>bool</code>|<code class='datatype'>void</code> <code class='argument'>modify_parent</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-parent'></span>Parameter <code class='parameter'>parent</code></dt> <dd></dd><dd class='body--doc'><p>Mapping to be shadowed.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-shadow'></span>Parameter <code class='parameter'>shadow</code></dt> <dd></dd><dd class='body--doc'><p>Initial shadow of <code>parent</code>.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'><span id='p-modify_parent'></span>Parameter <code class='parameter'>modify_parent</code></dt> <dd></dd><dd class='body--doc'><p>Modifications should be done to <code>parent</code> rather than to <code>shadow</code>. If this is set, only entries that are already present in <code>shadow</code> can be modified by later operations.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
388ed92005-02-01Martin Stjernholm <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>create</b></span>
388ed92005-02-01Martin Stjernholm </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='object'>Mapping.ShadowedMapping</span> <span class='class'>Mapping.ShadowedMapping</span><b>(</b><code class='datatype'>mapping</code>|<code class='object unresolved'>ShadowedMapping</code> <code class='argument'>parent</code><b>)</b></code></p></dd> </dl>
388ed92005-02-01Martin Stjernholm 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>parent</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='modifier'>protected</code> <code class='datatype'>mapping</code>|<code class='object unresolved'>ShadowedMapping</code> Mapping.ShadowedMapping.<b><span class='variable'>parent</span></b></code></p></dd> </dl> </dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Multiset</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Multiset handling.</p> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Multiset.Iterator</b></h2> </dt><dd><dl class='group--doc'>
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>An object of this class is returned by <code>get_iterator()</code> when called with a multiset.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>get_iterator</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
5af4c12009-02-24Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>predef::Iterator</b></span>
5af4c12009-02-24Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='datatype'>inherit predef::Iterator</span> : <span class='inherit'>predef::Iterator</span></code></p></dd> </dl> </dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Int</b></h2> </dt><dd>
5af4c12009-02-24Henrik Grubbström (Grubba) 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>NATIVE_MIN</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>NATIVE_MAX</b></span><br> </dt> <dd><p><code><code class='datatype'>constant</code> Int.<code class='constant'>NATIVE_MIN</code></code><br> <code><code class='datatype'>constant</code> Int.<code class='constant'>NATIVE_MAX</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>The limits for using the native representation of integers on the current architecture. Any integer that is outside this range uses a more complex and slower representation. Also, some builtin functions that don't expect very large integers might start to complain about invalid argument type when given values outside this range (they typically say something like "Expected integer, got object").</p> <p> <code>NATIVE_MIN</code> is not greater than <code class='expr'>-2147483648</code> (<code class='expr'>-0x80000000</code>).</p> <p> <code>NATIVE_MAX</code> is not less than <code class='expr'>2147483647</code> (<code class='expr'>0x7fffffff</code>).</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The size of the native integers can be controlled when Pike is compiled with the configure flags <code class='expr'>--with-int-int</code>, <code class='expr'>--with-long-int</code>, and <code class='expr'>--with-long-long-int</code>. The default is to use the longest available integer type that fits inside a pointer, which typically means that it's 64 bit on "true" 64 bit architectures.</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>inf</b></span>
1f918f2002-05-26Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='object unresolved'>Inf</code> Int.<b><span class='variable'>inf</span></b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>An object that behaves like positive infinity.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
c3fe742003-02-05Martin Nilsson 
e4e3f32002-04-06Martin Nilsson 
50af352002-07-15Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>parity</b></span>
50af352002-07-15Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>parity</span>(</b><code class='datatype'>int(0..)</code> <code class='argument'>value</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns the parity of the integer <code>value</code>. If the parity is odd 1 is returned. If it is even 0 is returned.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
dea86c2004-04-05Martin Stjernholm <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>reflect</b></span>
dea86c2004-04-05Martin Stjernholm </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int(0..)</code> <b><span class='method'>reflect</span>(</b><code class='datatype'>int</code> <code class='argument'>value</code>, <code class='datatype'>int(0..)</code> <code class='argument'>bits</code><b>)</b></code></p></dd>
dea86c2004-04-05Martin Stjernholm  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Reverses the order of the low order <code>bits</code> number of bits of the value <code>value</code>.</p>
dea86c2004-04-05Martin Stjernholm </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>Any higher order bits of the value will be cleared. The returned value will thus be unsigned.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>reverse()</code>, <code>swap_word()</code>, <code>swap_long()</code></p>
dea86c2004-04-05Martin Stjernholm </dd></dl>
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>swap_long</b></span>
1f918f2002-05-26Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int(32bit)</code> <b><span class='method'>swap_long</span>(</b><code class='datatype'>int(32bit)</code> <code class='argument'>i</code><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Swaps the upper and lower word in a longword, and the upper and lower bytes in the words. Simply put, the bytes are reversed.</p>
1f918f2002-05-26Martin Nilsson </dd>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>swap_word()</code></p>
c3fe742003-02-05Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
dea86c2004-04-05Martin Stjernholm <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>swap_word</b></span>
dea86c2004-04-05Martin Stjernholm </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int(16bit)</code> <b><span class='method'>swap_word</span>(</b><code class='datatype'>int(16bit)</code> <code class='argument'>i</code><b>)</b></code></p></dd>
dea86c2004-04-05Martin Stjernholm  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Swaps the upper and lower byte in a word.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>swap_long()</code></p>
dea86c2004-04-05Martin Stjernholm </dd></dl>
f6a4222017-07-10Henrik Grubbström (Grubba) <dl><dt><h2 class='header'>Class <b class='ms datatype'>Int.Inf</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>The type of <code>Int.inf</code>. Do not create more instances of this.</p> </dd></dl></dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Float</b></h2> </dt><dd>
dea86c2004-04-05Martin Stjernholm 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>DIGITS_10</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>MIN_10_EXP</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>MAX_10_EXP</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>MIN</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>MAX</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>EPSILON</b></span><br> </dt> <dd><p><code><code class='datatype'>constant</code> Float.<code class='constant'>DIGITS_10</code></code><br> <code><code class='datatype'>constant</code> Float.<code class='constant'>MIN_10_EXP</code></code><br> <code><code class='datatype'>constant</code> Float.<code class='constant'>MAX_10_EXP</code></code><br> <code><code class='datatype'>constant</code> Float.<code class='constant'>MIN</code></code><br> <code><code class='datatype'>constant</code> Float.<code class='constant'>MAX</code></code><br> <code><code class='datatype'>constant</code> Float.<code class='constant'>EPSILON</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>These constants define the limits for floats on the current architecture:</p> <dl class='group--doc'><dt>DIGITS_10</dt> <dd><p>The number of decimal digits that can be represented. Any number with this many decimal digits can be stored in a float and converted back to decimal form without change. <code>DIGITS_10</code> is not less than <code class='expr'>6</code>.</p> </dd> <dt>MIN_10_EXP</dt> <dt>MAX_10_EXP</dt> <dd><p>Limits of the exponent in decimal base. 10 raised to any number within this range can be represented in normalized form. <code>MIN_10_EXP</code> is not greater than <code class='expr'>-37</code>. <code>MAX_10_EXP</code> is not less than <code class='expr'>37</code>.</p> </dd> <dt>MIN</dt> <dd><p>The smallest normalized float greater than zero. It's not greater than <code class='expr'>1e-37</code>.</p> </dd> <dt>MAX</dt> <dd><p>The largest finite float. It's not less than <code class='expr'>1e37</code>.</p> </dd> <dt>EPSILON</dt> <dd><p>The difference between 1 and the smallest value greater than 1 that can be represented. It's not greater than <code class='expr'>1e-5</code>.</p> </dd> </dl> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The size of the float type can be controlled when Pike is compiled with the configure flags <code class='expr'>--with-double-precision</code> and <code class='expr'>--with-long-double-precision</code>. The default is to use the longest available float type that fits inside a pointer.</p>
c3fe742003-02-05Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
70bc302014-09-28Henrik Grubbström (Grubba) 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>FLOAT_PRECISION</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>DOUBLE_PRECISION</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>LONG_DOUBLE_PRECISION</b></span><br>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>constant</code> Float.<code class='constant'>FLOAT_PRECISION</code></code><br> <code><code class='datatype'>constant</code> Float.<code class='constant'>DOUBLE_PRECISION</code></code><br> <code><code class='datatype'>constant</code> Float.<code class='constant'>LONG_DOUBLE_PRECISION</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Tells which C compiler float type that is used for Pike floats. Only one of these constants will exist (with the value <code class='expr'>1</code>) at runtime.</p> <dl class='group--doc'><dt>FLOAT_PRECISION</dt> <dd><p>The <code class='expr'>float</code> type of the C compiler is used.</p> </dd> <dt>DOUBLE_PRECISION</dt> <dd><p>The <code class='expr'>double</code> type of the C compiler is used.</p> </dd> <dt>LONG_DOUBLE_PRECISION</dt> <dd><p>The <code class='expr'>long&nbsp;double</code> type of the C compiler is used.</p> </dd> </dl> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The float type can be controlled when Pike is compiled with the configure flags <code class='expr'>--with-double-precision</code> and <code class='expr'>--with-long-double-precision</code>. The default is to use the longest available float type that fits inside a pointer.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson  <hr /> <dl class='group--doc'>
70bc302014-09-28Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>isnan</b></span>
50af352002-07-15Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>isnan</span>(</b><code class='datatype'>float</code> <code class='argument'>x</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns true if <code>x</code> is nan.</p> </dd></dl> </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Function</b></h2> </dt><dd>
50af352002-07-15Martin Nilsson 
1f72bf2004-09-18Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>Y</b></span>
1f72bf2004-09-18Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <b><span class='method'>Y</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>The dreaded fixpoint combinator "Y".</p> <p> The Y combinator is useful when writing recursive lambdas. It converts a lambda that expects a self-reference as its first argument into one which can be called without this argument.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>This example creates a lambda that computes the faculty function.</p> <pre><code><span class='ns'>Function</span><span class='delim'>.</span>Y<span class='delim'>(</span><span class='lang'>lambda</span><span class='delim'>(</span><span class='type'>function</span> f<span class='delim'>,</span> <span class='type'>int</span> n<span class='delim'>)</span> <span class='delim'>{</span> <span class='lang'>return</span> n<span class='delim'>&gt;</span>1? n<span class='delim'>*</span>f<span class='delim'>(</span>n<span class='delim'>-</span>1<span class='delim'>)</span> <span class='delim'>:</span> 1<span class='delim'>;</span> <span class='delim'>}</span><span class='delim'>)</span> </code></pre> </pre></dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>this_function</code></p>
1f72bf2004-09-18Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>call_callback</b></span>
1f918f2002-05-26Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>void</code> <b><span class='method'>call_callback</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Call a callback function, but send throws from the callback function (ie, errors) to master()-&gt;handle_error. Also accepts if f is zero (0) without error.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><pre><code>Functions.call_callback(the_callback,some,arguments);</code></pre><p>equals</p> <pre><code><span class='delim'>{</span> <span class='type'>mixed</span> err<span class='delim'>=</span><span class='lang'>catch</span> <span class='delim'>{</span> <span class='lang'>if</span> <span class='delim'>(</span>the_callback<span class='delim'>)</span> the_callback<span class='delim'>(</span>some<span class='delim'>,</span>arguments<span class='delim'>)</span><span class='delim'>;</span> <span class='delim'>}</span><span class='delim'>;</span> <span class='lang'>if</span> <span class='delim'>(</span>err<span class='delim'>)</span> master<span class='delim'>(</span><span class='delim'>)</span>-&gt;handle_error<span class='delim'>(</span>err<span class='delim'>)</span><span class='delim'>;</span> <span class='delim'>}</span> </code></pre><p>(Approximately, since call_callback also calls handle_error if 0 were thrown.)</p> </pre></dd></dl>
e4e3f32002-04-06Martin Nilsson 
c3fe742003-02-05Martin Nilsson 
8ae0032003-10-29Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>composite</b></span>
8ae0032003-10-29Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <b><span class='method'>composite</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) ... <code class='argument'>f</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Creates a composite function of the provided functions. The composition function of f() and g(), q(x)=f(g(x)), is created by <code class='expr'>function&nbsp;q&nbsp;=&nbsp;Function.composite(f,&nbsp;g);</code>.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><pre><code>map<span class='delim'>(</span>input<span class='delim'>/</span><span class='string'>","</span><span class='delim'>,</span> <span class='ns'>Function</span><span class='delim'>.</span>composite<span class='delim'>(</span><span class='ns'>String</span><span class='delim'>.</span>trim<span class='delim'>,</span> upper_case<span class='delim'>)</span><span class='delim'>)</span><span class='delim'>;</span> </code></pre> </pre></dd></dl>
8ae0032003-10-29Henrik Grubbström (Grubba) 
c628122002-10-19Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>curry</b></span>
c628122002-10-19Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>function</code>(<code class='datatype'>mixed</code> ... :<code class='datatype'>function</code>(<code class='datatype'>mixed</code> ... :<code class='datatype'>mixed</code>|<code class='datatype'>void</code>)) <b><span class='method'>curry</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Partially evaluate a function call.</p> <p> This function allows N parameters to be given to a function taking M parameters (N&lt;=M), yielding a new function taking M-N parameters.</p> <p> What is actually returned from this function is a function taking N parameters, and returning a function taking M-N parameters.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>This example creates a function adding 7 to its argument.</p> <pre><code>Function.curry(`+)(7)</code></pre> </pre></dd></dl>
c628122002-10-19Martin Nilsson 
8831a42004-09-18Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>defined</b></span>
8831a42004-09-18Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>string</code> <b><span class='method'>defined</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>fun</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns a string with filename and linenumber where <code>fun</code> was defined.</p> <p> Returns <code class='expr'>0</code> (zero) when no line can be found, e.g. for builtin functions and functions in destructed objects.</p>
8831a42004-09-18Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>splice_call</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>splice_call</span>(</b><code class='datatype'>array</code> <code class='argument'>args</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code>, <code class='datatype'>mixed</code>|<code class='datatype'>void</code> ... <code class='argument'>extra</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>Calls the given function with the <code>args</code> array plus the optional extra arguments as its arguments and returns the result.</p> <p> Most useful in conjunction with <code>map</code>, and particularly in combination with <code>sscanf</code> with <code class='expr'>"...%{...%}..."</code> scan strings (which indeed was what it was invented for in the first place).</p> </dd> <dt class='head--doc'><span id='p-args'></span>Parameter <code class='parameter'>args</code></dt> <dd></dd><dd class='body--doc'><p>The first arguments the function <code>f</code> expects.</p> </dd> <dt class='head--doc'><span id='p-f'></span>Parameter <code class='parameter'>f</code></dt> <dd></dd><dd class='body--doc'><p>The function to apply the arguments on.</p> </dd> <dt class='head--doc'><span id='p-extra'></span>Parameter <code class='parameter'>extra</code></dt> <dd></dd><dd class='body--doc'><p>Optional extra arguments to send to <code>f</code>.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Whatever the supplied function <code>f</code> returns.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><pre><code><span class='type'>class</span> Product<span class='delim'>(</span><span class='type'>string</span> name<span class='delim'>,</span> <span class='type'>string</span> version<span class='delim'>)</span> <span class='delim'>{</span> <span class='type'>string</span> _sprintf<span class='delim'>(</span><span class='delim'>)</span> <span class='delim'>{</span> <span class='lang'>return</span> sprintf<span class='delim'>(</span><span class='string'>"Product(%s/%s)"</span><span class='delim'>,</span> name<span class='delim'>,</span> version<span class='delim'>)</span><span class='delim'>;</span> <span class='delim'>}</span> <span class='delim'>}</span> map<span class='delim'>(</span><span class='delim'>(</span><span class='delim'>{</span> <span class='delim'>(</span><span class='delim'>{</span> <span class='string'>"pike"</span><span class='delim'>,</span> <span class='string'>"7.1.11"</span> <span class='delim'>}</span><span class='delim'>)</span><span class='delim'>,</span> <span class='delim'>(</span><span class='delim'>{</span> <span class='string'>"whitefish"</span><span class='delim'>,</span> <span class='string'>"0.1"</span> <span class='delim'>}</span><span class='delim'>)</span> <span class='delim'>}</span><span class='delim'>)</span><span class='delim'>,</span> <span class='ns'>Function</span><span class='delim'>.</span>splice_call<span class='delim'>,</span> Product<span class='delim'>)</span><span class='delim'>;</span> <span class='delim'>(</span><span class='delim'>{</span> <span class='comment'>/* 2 elements */</span> Product<span class='delim'>(</span>pike<span class='delim'>/</span>7.1<span class='delim'>.</span>11<span class='delim'>)</span><span class='delim'>,</span> Product<span class='delim'>(</span>whitefish<span class='delim'>/</span>0.1<span class='delim'>)</span> <span class='delim'>}</span><span class='delim'>)</span> </code></pre> </pre></dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson 
1f72bf2004-09-18Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>uncurry</b></span>
1f72bf2004-09-18Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>function</code>(<code class='datatype'>mixed</code> ... :<code class='datatype'>mixed</code>) <b><span class='method'>uncurry</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code><b>)</b></code></p></dd>
1f72bf2004-09-18Martin Nilsson 
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>This function, given a function taking N parameters, returns a new function taking N+1 parameters. The first argument will be ignored.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><pre><code>&gt; Function.uncurry(`+)(7,2,3) Result: 5</code></pre> </pre></dd></dl> <dl><dt><h2 class='header'>Class <b class='ms datatype'>Function.bind</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Partially evaluate a function call.</p> <p> This function returns a function that when called will do the specified argument mapping. It is similar to <code>curry</code>, but allows more dynamic changes of the argument evaluation, you can leave the first argument unspecified while setting others, or simply change the argument order.</p> </dd> <dt class='head--doc'><span id='p-f'></span>Parameter <code class='parameter'>f</code></dt> <dd></dd><dd class='body--doc'><p>The first argument is the function to be called.</p> </dd> <dt class='head--doc'><span id='p-bind_args'></span>Parameter <code class='parameter'>bind_args</code></dt> <dd></dd><dd class='body--doc'><p>All other arguments are either a generic value, which will be sent as-is to the function or one of the placeholder values defined in <code>Function.Placeholder</code>, or one of your own implementation (inherit <code>Function.Placeholder.Base</code> and implement the value function.).</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>This example returns a function that limits the given argument to between 0 and 99.</p> <pre><code><span class='lang'>import</span> <span class='ns'>Function</span><span class='delim'>.</span>Placeholder<span class='delim'>;</span> <span class='type'>function</span> clip <span class='delim'>=</span> <span class='ns'>Function</span><span class='delim'>.</span>bind<span class='delim'>(</span>limit<span class='delim'>,</span> 0<span class='delim'>,</span> arg0<span class='delim'>,</span> 100<span class='delim'>)</span><span class='delim'>;</span> </code></pre> </pre></dd></dl>
1f72bf2004-09-18Martin Nilsson 
c628122002-10-19Martin Nilsson <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>f</b></span><br> <span class='homogen--type'>Variable</span> <span class='homogen--name'><b>bind_args</b></span><br>
c628122002-10-19Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) Function.bind.<b><span class='variable'>f</span></b></code><br> <code><code class='datatype'>array</code>(<code class='datatype'>mixed</code>) Function.bind.<b><span class='variable'>bind_args</span></b></code></p></dd> </dl>
c628122002-10-19Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>create</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='object'>Function.bind</span> <span class='class'>Function.bind</span><b>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code>, <code class='datatype'>mixed</code> ... <code class='argument'>bind_args</code><b>)</b></code></p></dd> </dl> </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Function.Placeholder</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Placeholder arguments for <code>Function.bind</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
c3fe742003-02-05Martin Nilsson <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Constant</span> <span class='homogen--name'><b>arg0</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>arg1</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>arg2</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>arg3</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>arg4</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>arg5</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>arg6</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>arg7</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>arg8</b></span><br> <span class='homogen--type'>Constant</span> <span class='homogen--name'><b>arg9</b></span><br> </dt> <dd><p><code><code class='datatype'>constant</code> Function.Placeholder.<code class='constant'>arg0</code></code><br> <code><code class='datatype'>constant</code> Function.Placeholder.<code class='constant'>arg1</code></code><br> <code><code class='datatype'>constant</code> Function.Placeholder.<code class='constant'>arg2</code></code><br> <code><code class='datatype'>constant</code> Function.Placeholder.<code class='constant'>arg3</code></code><br> <code><code class='datatype'>constant</code> Function.Placeholder.<code class='constant'>arg4</code></code><br> <code><code class='datatype'>constant</code> Function.Placeholder.<code class='constant'>arg5</code></code><br> <code><code class='datatype'>constant</code> Function.Placeholder.<code class='constant'>arg6</code></code><br> <code><code class='datatype'>constant</code> Function.Placeholder.<code class='constant'>arg7</code></code><br> <code><code class='datatype'>constant</code> Function.Placeholder.<code class='constant'>arg8</code></code><br> <code><code class='datatype'>constant</code> Function.Placeholder.<code class='constant'>arg9</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>arg&lt;n&gt; will return an instance of <code>Arg</code> that returns the n:th arg. For convenience for c++11 developers _0, _1 etc also works.</p> <p> Note that arg0 is the first argument, not arg1</p>
70bc302014-09-28Henrik Grubbström (Grubba) </dd></dl>
c3fe742003-02-05Martin Nilsson 
c628122002-10-19Martin Nilsson <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>rest</b></span>
c628122002-10-19Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='object unresolved'>Arg</code> Function.Placeholder.<b><span class='variable'>rest</span></b></code></p></dd>
c628122002-10-19Martin Nilsson 
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Return all arguments not used by any <code>Arg</code> or <code>Splice</code>.</p> <p> Unlike <code>Splice</code> this will return non-continous unused arguments.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>This creates a version of call_out that has the function argument as the last argument</p> <pre><code>import Function.Placeholder; Function.bind( call_out, Arg(-1), rest)</code></pre> </pre></dd></dl> <dl><dt><h2 class='header'>Class <b class='ms datatype'>Function.Placeholder.Arg</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Arg(x) returns the value of argument X</p> </dd></dl>
70bc302014-09-28Henrik Grubbström (Grubba)  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>create</b></span>
70bc302014-09-28Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='object'>Function.Placeholder.Arg</span> <span class='class'>Function.Placeholder.Arg</span><b>(</b><code class='datatype'>int</code> <code class='argument'>num</code><b>)</b></code></p></dd> </dl>
c628122002-10-19Martin Nilsson 
dea86c2004-04-05Martin Stjernholm <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>Base</b></span>
dea86c2004-04-05Martin Stjernholm </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='datatype'>inherit Base</span> : <span class='inherit'>Base</span></code></p></dd> </dl>
dea86c2004-04-05Martin Stjernholm 
ac9c552013-12-06Henrik Grubbström (Grubba) <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>num</b></span>
ac9c552013-12-06Henrik Grubbström (Grubba) </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>int</code> Function.Placeholder.Arg.<b><span class='variable'>num</span></b></code></p></dd> </dl>
ac9c552013-12-06Henrik Grubbström (Grubba) 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>value</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>value</span>(</b><code class='object unresolved'>bind</code> <code class='argument'>x</code>, <code class='datatype'>array</code> <code class='argument'>args</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd class='body--doc'><p>The function that is called to return the argument value.</p> </dd></dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Function.Placeholder.Expr</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Expr(x) returns the result of calling <code>x</code>. The function will be passed the list of arguments.</p> <p> If _splice is true, zero or more argument is returned in an array</p> <p> Function.Placeholder.arg1 is thus more or less equivalent to</p> <pre><code>Expr<span class='delim'>(</span><span class='lang'>lambda</span><span class='delim'>(</span><span class='type'>array</span> args<span class='delim'>)</span><span class='delim'>{</span><span class='lang'>return</span> args<span class='delim'>[</span>1<span class='delim'>]</span><span class='delim'>;</span><span class='delim'>}</span><span class='delim'>)</span><span class='delim'>;</span> </code></pre>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>func</b></span><br> <span class='homogen--type'>Variable</span> <span class='homogen--name'><b>_splice</b></span><br>
e4e3f32002-04-06Martin Nilsson </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) Function.Placeholder.Expr.<b><span class='variable'>func</span></b></code><br> <code><code class='datatype'>void</code>|<code class='object unresolved'>bool</code> Function.Placeholder.Expr.<b><span class='variable'>_splice</span></b></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson 
dea86c2004-04-05Martin Stjernholm <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
f6a4222017-07-10Henrik Grubbström (Grubba) <span class='homogen--name'><b>create</b></span>
dea86c2004-04-05Martin Stjernholm </dt>
f6a4222017-07-10Henrik Grubbström (Grubba) <dd><p><code><span class='object'>Function.Placeholder.Expr</span> <span class='class'>Function.Placeholder.Expr</span><b>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>func</code>, <code class='datatype'>void</code>|<code class='object unresolved'>bool</code> <code class='argument'>_splice</code><b>)</b></code></p></dd> </dl>
dea86c2004-04-05Martin Stjernholm 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
f6a4222017-07-10Henrik Grubbström (Grubba) <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>Base</b></span> </dt> <dd><p><code><span class='datatype'>inherit Base</span> : <span class='inherit'>Base</span></code></p></dd> </dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>Function.Placeholder.Splice</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Splice(from) adds all arguments starting with argument number <code class='expr'>from</code>, optionally ending with end. Equivalent to <code class='expr'>args[from&nbsp;..&nbsp;end]</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span> </dt> <dd><p><code><span class='object'>Function.Placeholder.Splice</span> <span class='class'>Function.Placeholder.Splice</span><b>(</b><code class='datatype'>int</code> <code class='argument'>from</code>, <code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>end</code><b>)</b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Variable</span> <span class='homogen--name'><b>from</b></span><br> <span class='homogen--type'>Variable</span> <span class='homogen--name'><b>end</b></span><br> </dt> <dd><p><code><code class='datatype'>int</code> Function.Placeholder.Splice.<b><span class='variable'>from</span></b></code><br> <code><code class='datatype'>void</code>|<code class='datatype'>int</code> Function.Placeholder.Splice.<b><span class='variable'>end</span></b></code></p></dd> </dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>Base</b></span> </dt> <dd><p><code><span class='datatype'>inherit Base</span> : <span class='inherit'>Base</span></code></p></dd> </dl> </dd></dl></dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Program</b></h2> </dt><dd> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>all_inherits</b></span> </dt> <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>program</code>) <b><span class='method'>all_inherits</span>(</b><code class='datatype'>program</code> <code class='argument'>p</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Enumerate all programs this program inherits, directly or indirectly. Similar to inherit_tree() but returns a flat array.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>&gt; class a{} &gt; class b{} &gt; class c{ inherit a; } &gt; class d{ inherit b; inherit c; } &gt; Program.inherit_tree(d); Result: ({ /* 3 elements */ b, c, a })</p> </pre></dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>defined</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>defined</span>(</b><code class='datatype'>program</code> <code class='argument'>p</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns a string with filename and linenumber describing where the program <code>p</code> was defined.</p> <p> The returned string is of the format <code class='expr'>"filename:linenumber"</code>.</p> <p> If it cannot be determined where the program was defined, <code class='expr'>0</code> (zero) will be returned.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>defined</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>defined</span>(</b><code class='datatype'>program</code> <code class='argument'>x</code>, <code class='datatype'>string</code> <code class='argument'>identifier</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns a string with filename and linenumber where <code>idenfifier</code> in <code>x</code> was defined.</p> <p> Returns <code class='expr'>0</code> (zero) when no line can be found, e.g. for builtin functions.</p> <p> If <code>idenfier</code> can not be found in <code>x</code> this function returns where the program is defined.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>implements</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>implements</span>(</b><code class='datatype'>program</code> <code class='argument'>prog</code>, <code class='datatype'>program</code> <code class='argument'>api</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns 1 if <code>prog</code> implements <code>api</code>.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>inherit_list</b></span> </dt> <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>program</code>) <b><span class='method'>inherit_list</span>(</b><code class='datatype'>program</code> <code class='argument'>p</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns an array with the programs that <code>p</code> has inherited.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>inherit_tree</b></span> </dt> <dd><p><code><code class='datatype'>array</code> <b><span class='method'>inherit_tree</span>(</b><code class='datatype'>program</code> <code class='argument'>p</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Recursively builds a inheritance tree by fetching programs inheritance lists.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns an array with programs or arrays as elements.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>&gt; class a{} &gt; class b{} &gt; class c{ inherit a; } &gt; class d{ inherit b; inherit c; } &gt; Program.inherit_tree(d); Result: ({ /* 3 elements */ d, ({ /* 1 element */ program }), ({ /* 2 elements */ c, ({ /* 1 element */ program }) }) })</p> </pre></dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>inherits</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>inherits</span>(</b><code class='datatype'>program</code>|<code class='datatype'>object</code> <code class='argument'>child</code>, <code class='datatype'>program</code> <code class='argument'>parent</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns 1 if <code>child</code> has inherited <code>parent</code>.</p> </dd></dl> </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>ADT</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Various Abstract Data Types.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>_ADT</b></span> </dt> <dd><p><code><span class='datatype'>inherit _ADT</span> : <span class='inherit'>_ADT</span></code></p></dd> </dl> <dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.BitBuffer</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Implements a FIFO bit buffer, i.e. a buffer that operates on bits instead of bytes. It is not designed for performance, but as a way to handle complicated file formats and other standards where you may need to work on unaligned data units of sub byte size, without having to fry your brain while keeping track of all the bits yourself.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>&gt; ADT.BitBuffer b=ADT.BitBuffer(); &gt; b-&gt;put1(2); (1) Result: ADT.BitBuffer(11) &gt; b-&gt;put0(15); (2) Result: ADT.BitBuffer("\300\0"0) &gt; b-&gt;drain(); (3) Result: "\300\0" &gt; sizeof(b); (4) Result: 1</p> </pre></dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_sizeof</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>sizeof</span>(</b> <span class='class'>ADT.BitBuffer</span> <span class='argument'>arg</span> <b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p><code>sizeof()</code> will return the number of bits in the buffer.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span> </dt> <dd><p><code><span class='object'>ADT.BitBuffer</span> <span class='class'>ADT.BitBuffer</span><b>(</b><code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>data</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>The buffer can be initialized with initial data during creation.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>drain</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>drain</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Drains the buffer of all full (8-bits wide) bytes.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>feed</b></span> </dt> <dd><p><code><code class='object unresolved'>this_program</code> <b><span class='method'>feed</span>(</b><code class='datatype'>string</code> <code class='argument'>x</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Adds full bytes to the buffer.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>get</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>get</span>(</b><code class='datatype'>int</code> <code class='argument'>bits</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Get <code>bits</code> from the buffer.</p> </dd> <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>Throws an error in case of data underflow.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The bits are extracted with the most significant bit first.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>put</b></span> </dt> <dd><p><code><code class='object unresolved'>this_program</code> <b><span class='method'>put</span>(</b><code class='datatype'>int</code> <code class='argument'>value</code>, <code class='datatype'>int</code> <code class='argument'>bits</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Put <code>bits</code> number of bits with the value <code>value</code> into the buffer.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p><code>value</code> must not be larger than what can be stored with the number of bits given in <code>bits</code>.</p> </dd> <dt class='head--doc'>Note</dt> <dd class='body--doc'><p>The bits are added to the buffer with the most significant bit first.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>put0</b></span> </dt> <dd><p><code><code class='object unresolved'>this_program</code> <b><span class='method'>put0</span>(</b><code class='datatype'>int</code> <code class='argument'>bits</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Put <code>bits</code> number of 0 bits into the buffer.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>put1</b></span> </dt> <dd><p><code><code class='object unresolved'>this_program</code> <b><span class='method'>put1</span>(</b><code class='datatype'>int</code> <code class='argument'>bits</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Put <code>bits</code> number of 1 bits into the buffer.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>read</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>read</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>bytes</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Reads <code>bytes</code> (or less) bytes from the buffer and returns as string.</p> </dd></dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.CircularList</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>This is an circular list implemented by an array. It has a constant time complexity for pop and push. It has a limited max size but it can be increased with the method allocate.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_equal</b></span> </dt> <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>equal</span>(</b><span class='class'>ADT.CircularList</span> <span class='argument'>from</span>, <code class='datatype'>mixed</code> <code class='argument'>coll</code><b>)</b></code></p></dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns <tt>true</tt> if the object <code>coll</code> is a <code>CircularList</code> and contains the same values in the same order.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_get_iterator</b></span> </dt> <dd><p><code><span class='class'>ADT.CircularList</span> <span class='method'>a</span>;<br> foreach( a; index; value ) or<br></code><code><code class='object unresolved'>CircularListIterator</code> <b><span class='method'>_get_iterator</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>ind</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Create and initiate a new CircularListIterator that could be used to iterate over this list.</p> </dd> <dt class='head--doc'><span id='p-ind'></span>Parameter <code class='parameter'>ind</code></dt> <dd></dd><dd class='body--doc'><p>If an <code>ind</code> value is supplied the iterator will be positioned at that index.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>An iterator.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_indices</b></span> </dt> <dd><p><code><code class='datatype'>array</code> <b><span class='method'>indices</span>(</b> <span class='class'>ADT.CircularList</span> <span class='argument'>arg</span> <b>)</b></code></p></dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The indices in this list as an array.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_insert_element</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>_insert_element</span>(</b><code class='datatype'>int</code> <code class='argument'>index</code>, <code class='datatype'>mixed</code> <code class='argument'>value</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Insert an element in the list at the position <code>index</code>, the value at the position <code>index</code> and all above will have their index increased by one.</p> </dd> <dt class='head--doc'><span id='p-index'></span>Parameter <code class='parameter'>index</code></dt> <dd></dd><dd class='body--doc'><p>The index to insert the value at.</p> </dd> <dt class='head--doc'><span id='p-value'></span>Parameter <code class='parameter'>value</code></dt> <dd></dd><dd class='body--doc'><p>The new value.</p> </dd> <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>An error if the index is out of range.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_remove_element</b></span> </dt> <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>_remove_element</span>(</b><code class='datatype'>int</code> <code class='argument'>index</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Remove the values at index <code>index</code> from the list.</p> </dd> <dt class='head--doc'><span id='p-index'></span>Parameter <code class='parameter'>index</code></dt> <dd></dd><dd class='body--doc'><p>The index to remove.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The removed value.</p> </dd> <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>An error if the index is out of range.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_search</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>search</span>(</b><span class='class'>ADT.CircularList</span> <span class='argument'>from</span>, <code class='datatype'>mixed</code> <code class='argument'>value</code>, <code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>start</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Search the list for a specific value. Return the index of the first value that is equal to <code>value</code>. If no value was found <code class='expr'>UNDEFINED</code> is returned instead</p> </dd> <dt class='head--doc'><span id='p-value'></span>Parameter <code class='parameter'>value</code></dt> <dd></dd><dd class='body--doc'><p>The value to find</p> </dd> <dt class='head--doc'><span id='p-start'></span>Parameter <code class='parameter'>start</code></dt> <dd></dd><dd class='body--doc'><p>If a start value is supplied it will start searching at the index <code>start</code>.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns the index of the found value or <code class='expr'>UNDEFINED</code>.</p> </dd> <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>An error if the start is out of range.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_sizeof</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>sizeof</span>(</b> <span class='class'>ADT.CircularList</span> <span class='argument'>arg</span> <b>)</b></code></p></dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The number of elements in this list.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_values</b></span> </dt> <dd><p><code><code class='datatype'>array</code> <b><span class='method'>values</span>(</b> <span class='class'>ADT.CircularList</span> <span class='argument'>arg</span> <b>)</b></code></p></dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The values in this list as an array.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`+</b></span> </dt> <dd><p><code><code class='object unresolved'>CircularList</code> res = <code class='class'>ADT.CircularList()</code>&#32;+&#32;<code class='class'>coll</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Addition operator</p> <p> Append the content of this CircularList and @<code>coll</code> and return the results as a new <code>CircularList</code>.</p> </dd> <dt class='head--doc'><span id='p-coll'></span>Parameter <code class='parameter'>coll</code></dt> <dd></dd><dd class='body--doc'><p>The lists to append to this list</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The result of the append as a new <code>CircularList</code>.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`[]</b></span> </dt> <dd><p><code><code class='datatype'>mixed</code> res = <code class='class'>ADT.CircularList()</code>[&#32;<code class='class'>index</code>&#32;]</code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Index operator</p> </dd> <dt class='head--doc'><span id='p-index'></span>Parameter <code class='parameter'>index</code></dt> <dd></dd><dd class='body--doc'><p>The index to get the value for, could be negative to index from the end.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The value at the index <code>index</code></p> </dd> <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>An error if the index is out of range.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`[]=</b></span> </dt> <dd><p><code><code class='class'>ADT.CircularList()</code>[&#32;<code class='class'>index</code>&#32;]&#32;=&#32;<code class='class'>value</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Index assign operator. Set the value at the index <code>index</code> to be <code>value</code></p> </dd> <dt class='head--doc'><span id='p-index'></span>Parameter <code class='parameter'>index</code></dt> <dd></dd><dd class='body--doc'><p>The index to set</p> </dd> <dt class='head--doc'><span id='p-value'></span>Parameter <code class='parameter'>value</code></dt> <dd></dd><dd class='body--doc'><p>The new value</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The new value at the index <code>index</code></p> </dd> <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>An error if the index is out of range.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>add</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>add</span>(</b><code class='datatype'>mixed</code> <code class='argument'>value</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Add a value at the front of the list</p> </dd> <dt class='head--doc'><span id='p-value'></span>Parameter <code class='parameter'>value</code></dt> <dd></dd><dd class='body--doc'><p>The value to add.</p> </dd> <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>An error if the list is full.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>allocate</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>allocate</span>(</b><code class='datatype'>int</code> <code class='argument'>elements</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Increase the maxsize of the CircularlList.</p> </dd> <dt class='head--doc'><span id='p-elements'></span>Parameter <code class='parameter'>elements</code></dt> <dd></dd><dd class='body--doc'><p>Add this number of new elements to the list.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>cast</b></span> </dt> <dd><p><code><b>(</b><span class='datatype'><code class='datatype'>array</code></span><b>)</b><span class='class'>ADT.CircularList</span>()</code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Cast operator.</p> </dd> <dt class='head--doc'><span id='p-type'></span>Parameter <code class='parameter'>type</code></dt> <dd></dd><dd class='body--doc'><p>Casts to this type.</p> <p> Casts to the following types are supported:</p> <table class='box'><tr><td><code><code class='key'>"array"</code></code></td><td><p>Cast the content of this list to an array.</p> </td></tr> </table> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>An array with the contents of this list.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>clear</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>clear</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Clear the contents of the list.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span> </dt> <dd><p><code><span class='object'>ADT.CircularList</span> <span class='class'>ADT.CircularList</span><b>(</b><code class='datatype'>array</code>|<code class='datatype'>int</code> <code class='argument'>arg</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Creates a new <code>CircularList</code> around the array arg or a new <code>CircularList</code> with the maximum size of arg.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>delete_value</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>delete_value</span>(</b><code class='datatype'>mixed</code> <code class='argument'>value</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Remove the first occurrence of the value <code>value</code> from the list.</p> </dd> <dt class='head--doc'><span id='p-value'></span>Parameter <code class='parameter'>value</code></dt> <dd></dd><dd class='body--doc'><p>The value to remove from the list.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The index of the removed element or -1 if there was no value to remove.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>first</b></span> </dt> <dd><p><code><code class='object unresolved'>CircularListIterator</code> <b><span class='method'>first</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Create and initiate a new CircularListIterator that could be used to iterate over this list.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>An iterator positioned at the first element in the list.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>is_empty</b></span> </dt> <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>is_empty</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns <code class='expr'>1</code> if the list is empty otherwise <code class='expr'>0</code>.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>last</b></span> </dt> <dd><p><code><code class='object unresolved'>CircularListIterator</code> <b><span class='method'>last</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Create and initiate a new CircularListIterator that could be used to iterate over this list.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>An iterator positioned after the last element in the list.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>max_size</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>max_size</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns the maximal size of this list.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>peek_back</b></span> </dt> <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>peek_back</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The value at the back of the list but do not remove it from the list.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>peek_front</b></span> </dt> <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>peek_front</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The value at the front of the list but do not remove it from the list.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>pop_back</b></span> </dt> <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>pop_back</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Remove the value at the back of the list and return it.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The value at the back of the list.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>pop_front</b></span> </dt> <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>pop_front</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Remove the value at the front of the list and return it.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>The value at the front of the list.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>push_back</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>push_back</span>(</b><code class='datatype'>mixed</code> <code class='argument'>value</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Add a new value at the end of the list.</p> </dd> <dt class='head--doc'><span id='p-value'></span>Parameter <code class='parameter'>value</code></dt> <dd></dd><dd class='body--doc'><p>The value to add.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>push_front</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>push_front</span>(</b><code class='datatype'>mixed</code> <code class='argument'>value</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Add a new value at the end of the list.</p> </dd> <dt class='head--doc'><span id='p-value'></span>Parameter <code class='parameter'>value</code></dt> <dd></dd><dd class='body--doc'><p>The value to add.</p> </dd></dl> <dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.CircularList.CircularListIterator</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>This is the iterator for the CircularList. It implements the IndexIterator and the OutputIterator.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_equal</b></span> </dt> <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>equal</span>(</b><span class='class'>ADT.CircularList.CircularListIterator</span> <span class='argument'>from</span>, <code class='datatype'>mixed</code> <code class='argument'>iter</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Compare this iterator with another iterator.</p> </dd> <dt class='head--doc'><span id='p-iter'></span>Parameter <code class='parameter'>iter</code></dt> <dd></dd><dd class='body--doc'><p>The iterator to compare with</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns <tt>true</tt> if both iterators iterates over the same objects and are positioned at the same spot.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`!</b></span> </dt> <dd><