EVOLUTION-MANAGER
Edit File: faststack.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Create a stack</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for faststack {fastmap}"><tr><td>faststack {fastmap}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Create a stack</h2> <h3>Description</h3> <p>A <code>faststack</code> is backed by a list. The backing list will grow or shrink as the stack changes in size. </p> <h3>Usage</h3> <pre> faststack(init = 20, missing_default = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>init</code></td> <td> <p>Initial size of the list that backs the stack. This is also used as the minimum size of the list; it will not shrink any smaller.</p> </td></tr> <tr valign="top"><td><code>missing_default</code></td> <td> <p>The value to return when <code>pop()</code> or <code>peek()</code> are called when the stack is empty. Default is <code>NULL</code>.</p> </td></tr> </table> <h3>Details</h3> <p><code>faststack</code> objects have the following methods: </p> <dl> <dt><code>push(x)</code></dt><dd> <p>Push an object onto the stack. </p> </dd> <dt><code>mpush(..., .list = NULL)</code></dt><dd> <p>Push objects onto the stack. <code>.list</code> can be a list of objects to add. </p> </dd> <dt><code>pop(missing = missing_default)</code></dt><dd> <p>Remove and return the top object on the stack. If the stack is empty, it will return <code>missing</code>, which defaults to the value of <code>missing_default</code> that <code>stack()</code> was created with (typically, <code>NULL</code>). </p> </dd> <dt><code>mpop(n, missing = missing_default)</code></dt><dd> <p>Remove and return the top <code>n</code> objects on the stack, in a list. The first element of the list is the top object in the stack. If <code>n</code> is greater than the number of objects in the stack, any requested items beyond those in the stack will be replaced with <code>missing</code> (typically, <code>NULL</code>). </p> </dd> <dt><code>peek(missing = missing_default)</code></dt><dd> <p>Return the top object on the stack, but do not remove it from the stack. If the stack is empty, this will return <code>missing</code>. </p> </dd> <dt><code>reset()</code></dt><dd> <p>Reset the stack, clearing all items. </p> </dd> <dt><code>size()</code></dt><dd> <p>Returns the number of items in the stack. </p> </dd> <dt><code>as_list()</code></dt><dd> <p>Return a list containing the objects in the stack, where the first element in the list is the object at the bottom of the stack, and the last element in the list is the object at the top of the stack. </p> </dd> </dl> <hr /><div style="text-align: center;">[Package <em>fastmap</em> version 1.1.0 <a href="00Index.html">Index</a>]</div> </body></html>