picrin-website/www/libs.html

239 lines
10 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Standard Libraries &#8212; Picrin 0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/classic.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="C API" href="capi.html" />
<link rel="prev" title="Language" href="lang.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="capi.html" title="C API"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="lang.html" title="Language"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Picrin 0.1 documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Standard Libraries</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="standard-libraries">
<h1>Standard Libraries<a class="headerlink" href="#standard-libraries" title="Permalink to this heading"></a></h1>
<p>Picrins all built-in libraries are described below.</p>
<section id="picrin-macro">
<h2>(picrin macro)<a class="headerlink" href="#picrin-macro" title="Permalink to this heading"></a></h2>
<p>Utility functions and syntaces for macro definition.</p>
<ul class="simple">
<li><p>define-macro</p></li>
<li><p>gensym</p></li>
<li><p>ungensym</p></li>
<li><p>macroexpand</p></li>
<li><p>macroexpand-1</p></li>
</ul>
<p>Old-fashioned macro.</p>
<ul class="simple">
<li><p>identifier?</p></li>
<li><p>identifier=?</p></li>
<li><p>make-syntactic-closure</p></li>
<li><p>close-syntax</p></li>
<li><p>capture-syntactic-environment</p></li>
<li><p>sc-macro-transformer</p></li>
<li><p>rsc-macro-transformer</p></li>
</ul>
<p>Syntactic closures.</p>
<ul class="simple">
<li><p>er-macro-transformer</p></li>
<li><p>ir-macro-transformer</p></li>
<li><p>strip-syntax</p></li>
</ul>
<p>Explicit renaming macro family.</p>
</section>
<section id="picrin-array">
<h2>(picrin array)<a class="headerlink" href="#picrin-array" title="Permalink to this heading"></a></h2>
<p>Resizable random-access list.</p>
<p>Technically, picrins array is implemented as a ring-buffer, effective double-ended queue data structure (deque) that can operate pushing and poping from both of front and back in constant time. In addition to the deque interface, array provides standard sequence interface similar to functions specified by R7RS.</p>
<ul>
<li><p><strong>(make-array [capacity])</strong></p>
<p>Returns a newly allocated array object. If capacity is given, internal data chunk of the array object will be initialized by capacity size.</p>
</li>
<li><p><strong>(array . objs)</strong></p>
<p>Returns an array initialized with objs.</p>
</li>
<li><p><strong>(array? . obj)</strong></p>
<p>Returns #t if obj is an array.</p>
</li>
<li><p><strong>(array-length ary)</strong></p>
<p>Returns the length of ary.</p>
</li>
<li><p><strong>(array-ref ary i)</strong></p>
<p>Like <code class="docutils literal notranslate"><span class="pre">list-ref</span></code>, return the object pointed by the index i.</p>
</li>
<li><p><strong>(array-set! ary i obj)</strong></p>
<p>Like <code class="docutils literal notranslate"><span class="pre">list-set!</span></code>, substitutes the object pointed by the index i with given obj.</p>
</li>
<li><p><strong>(array-push! ary obj)</strong></p>
<p>Adds obj to the end of ary.</p>
</li>
<li><p><strong>(array-pop! ary)</strong></p>
<p>Removes the last element of ary, and returns it.</p>
</li>
<li><p><strong>(array-unshift! ary obj)</strong></p>
<p>Adds obj to the front of ary.</p>
</li>
<li><p><strong>(array-shift! ary)</strong></p>
<p>Removes the first element of ary, and returns it.</p>
</li>
<li><p><strong>(array-map proc ary)</strong></p>
<p>Performs mapping operation on ary.</p>
</li>
<li><p><strong>(array-for-each proc ary)</strong></p>
<p>Performs mapping operation on ary, but discards the result.</p>
</li>
<li><p><strong>(array-&gt;list ary)</strong></p>
<p>Converts ary into list.</p>
</li>
<li><p><strong>(list-&gt;array list)</strong></p>
<p>Converts list into array.</p>
</li>
</ul>
</section>
<section id="picrin-dictionary">
<h2>(picrin dictionary)<a class="headerlink" href="#picrin-dictionary" title="Permalink to this heading"></a></h2>
<p>Symbol-to-object hash table.</p>
<ul>
<li><p><strong>(make-dictionary)</strong></p>
<p>Returns a newly allocated empty dictionary.</p>
</li>
<li><p><strong>(dictionary . plist)</strong></p>
<p>Returns a dictionary initialized with the content of plist.</p>
</li>
<li><p><strong>(dictionary? obj)</strong></p>
<p>Returns #t if obj is a dictionary.</p>
</li>
<li><p><strong>(dictionary-ref dict key)</strong></p>
<p>Look up dictionary dict for a value associated with key. If dict has a slot for key <cite>key</cite>, a pair containing the key object and the associated value is returned. Otherwise <cite>#f</cite> is returned.</p>
</li>
<li><p><strong>(dictionary-set! dict key obj)</strong></p>
<p>If there is no value already associated with key, this function newly creates a binding of key with obj. Otherwise, updates the existing binding with given obj.</p>
<p>If obj is <cite>#undefined</cite>, this procedure behaves like a deleter: it will remove the key/value slot with the name <cite>key</cite> from the dictionary. When no slot is associated with <cite>key</cite>, it will do nothing.</p>
</li>
<li><p><strong>(dictionary-size dict)</strong></p>
<p>Returns the number of registered elements in dict.</p>
</li>
<li><p><strong>(dicitonary-map proc dict)</strong></p>
<p>Perform mapping action onto dictionary object. <code class="docutils literal notranslate"><span class="pre">proc</span></code> is called by a sequence <code class="docutils literal notranslate"><span class="pre">(proc</span> <span class="pre">key1</span> <span class="pre">key2</span> <span class="pre">...)</span></code>.</p>
</li>
<li><p><strong>(dictionary-for-each proc dict)</strong></p>
<p>Similar to <code class="docutils literal notranslate"><span class="pre">dictionary-map</span></code>, but discards the result.</p>
</li>
<li><p><strong>(dictionary-&gt;plist dict)</strong></p></li>
<li><p><strong>(plist-&gt;dictionary plist)</strong></p></li>
<li><p><strong>(dictionary-&gt;alist dict)</strong></p></li>
<li><p><strong>(alist-&gt;dictionary alist)</strong></p>
<p>Conversion between dictionary and alist/plist.</p>
</li>
</ul>
</section>
<section id="picrin-user">
<h2>(picrin user)<a class="headerlink" href="#picrin-user" title="Permalink to this heading"></a></h2>
<p>When you start the REPL, you are dropped into here.</p>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div>
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Standard Libraries</a><ul>
<li><a class="reference internal" href="#picrin-macro">(picrin macro)</a></li>
<li><a class="reference internal" href="#picrin-array">(picrin array)</a></li>
<li><a class="reference internal" href="#picrin-dictionary">(picrin dictionary)</a></li>
<li><a class="reference internal" href="#picrin-user">(picrin user)</a></li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="lang.html"
title="previous chapter">Language</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="capi.html"
title="next chapter">C API</a></p>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/libs.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="capi.html" title="C API"
>next</a> |</li>
<li class="right" >
<a href="lang.html" title="Language"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Picrin 0.1 documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Standard Libraries</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2014, Yuichi Nishiwaki and other picrin contributors.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 6.1.3.
</div>
</body>
</html>