Skip to content

Commit

Permalink
Documentation updated
Browse files Browse the repository at this point in the history
  • Loading branch information
siefca committed May 31, 2016
1 parent 76d99ed commit e17f504
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ <h1>futils</h1>
<h4>Function Utilities Library</h4>
</div>
</div>
<section class="chapter" id="introduction"><h2 class="chapter">1 &nbsp;&nbsp; Introduction</h2><div class="group"><div class="paragraph"><p> <code>futils</code> is a library that adds some abstractions for managing functions in Clojure.</p><p>Currently provided macros and functions are:</p><ul><li><strong><a href='#futils.args'><code>futils.args/</code></a></strong><ul><li><a href='#argc'><code>argc</code></a><strong>counts arguments</strong> a function takes (for all arities),</li><li><a href='#relax'><code>relax</code></a> – transforms a function in a way that it accepts <strong>any number of arguments</strong>,</li><li><a href='#relax&#42;'><code>relax&#42;</code></a> – like <code>relax</code> but it requires to explicitly describe the accepted arities;</li></ul></li><li><strong><a href='#futils.named'><code>futils.named/</code></a></strong><ul><li><a href='#apply'><code>apply</code></a> – works like <code>clojure.core/apply</code> but on named arguments,</li><li><a href='#comp'><code>comp</code></a> – creates a function that is the <strong>composition</strong> of the given functions,</li><li><a href='#nameize'><code>nameize</code></a> – transforms a function in a way that it can take <strong>named arguments</strong>,</li><li><a href='#nameize&#42;'><code>nameize&#42;</code></a> – like <code>nameize</code> but requires symbols to be quoted;</li></ul></li><li><strong><a href='#futils.utils'><code>futils.utils/</code></a></strong><ul><li><a href='#frepeat'><code>frepeat</code></a> – returns a sequence generated by a function that uses named arguments.</li></ul></li></ul></div></div></section><section class="chapter" id="installation"><h2 class="chapter">2 &nbsp;&nbsp; Installation</h2><div class="group"><div class="paragraph"><p>Add dependencies to <code>project.clj</code>:</p><p><code>&#91;pl.randomseed/futils </code>"<code>1.2.1</code>"<code>&#93;</code></p><p>Then (depending on which functions should be used) require it in your program:</p><p><code>&#40;require 'futils.utils&#41;</code><br /> <code>&#40;require 'futils.args&#41;</code><br /> <code>&#40;require 'futils.named&#41;</code><br /></p><p>or:</p><p><code>&#40;ns your-namespace</code><br /> <code> &#40;:require &#91;futils.utils :as utils&#93;&#41;</code><br /> <code> &#40;:require &#91;futils.args  :as args&#93;&#41;</code><br /> <code> &#40;:require &#91;futils.named :as named&#93;&#41;&#41;</code></p></div></div></section><section class="chapter" id="usage"><h2 class="chapter">3 &nbsp;&nbsp; Usage</h2><section class="section" id="futils.args"><h3 class="section">3.1 &nbsp;&nbsp; futils.args</h3><div class="paragraph"><p>The <code>futils.args</code> namespace contains functions that provide positional arguments management, like counting or transforming other functions so they can accept variable number of arguments (with optional padding).</p></div><section class="subsection" id="argc"><h4 class="subsection">3.1.1 &nbsp;&nbsp; argc</h4><div class="code"><a name="argc-synopsis"></a><div hljs="hljs" language="clojure" no-escape="no-escape">(futils.args/argc f &amp; options)</div></div><div class="paragraph"><p>Determines the number of arguments that the given function takes and returns a map containing the following keys:</p><ul><li><code>:arities</code> – a sorted sequence containing number of arguments for all arities,</li><li><code>:engine</code>:<ul><li><code>:clj</code> – if metadata were used to determine arities – DEPRECATED);</li><li><code>:jvm</code> – if Java reflection methods were used to determine arities),</li></ul></li><li><code>:macro</code> – a flag informing whether the given object is a macro,</li><li><code>:variadic</code> – a flag informing whether the widest arity is variadic.</li></ul><p>Variadic parameter is counted as one of the possible arguments (if present).</p><p>The macro flag (<code>:macro</code> key with value <code>true</code>) is only present when macro was detected.</p><p>If the given argument cannot be used to obtain a Var bound to a functon or a function object then it returns <code>nil</code>.</p></div><div class="code"><a name="argc-usage"></a><h5>e.3.1 &nbsp;-&nbsp; Using <code>argc</code> on anonymous functions</h5><div hljs="hljs" language="clojure" no-escape="no-escape">(argc (fn ([x y]) ([])))
<section class="chapter" id="introduction"><h2 class="chapter">1 &nbsp;&nbsp; Introduction</h2><div class="group"><div class="paragraph"><p> <code>futils</code> is a library that adds some abstractions for managing and transforming functions in Clojure.</p><p>Currently provided macros and functions are:</p><ul><li><strong><a href='#futils.args'><code>futils.args/</code></a></strong><ul><li><a href='#argc'><code>argc</code></a><strong>counts arguments</strong> a function takes (for all arities),</li><li><a href='#relax'><code>relax</code></a> – transforms a function in a way that it accepts <strong>any number of arguments</strong>,</li><li><a href='#relax&#42;'><code>relax&#42;</code></a> – like <code>relax</code> but it requires to explicitly describe the accepted arities;</li></ul></li><li><strong><a href='#futils.named'><code>futils.named/</code></a></strong><ul><li><a href='#apply'><code>apply</code></a> – works like <code>clojure.core/apply</code> but on named arguments,</li><li><a href='#comp'><code>comp</code></a> – creates a function that is the <strong>composition</strong> of the given functions,</li><li><a href='#nameize'><code>nameize</code></a> – transforms a function in a way that it can take <strong>named arguments</strong>,</li><li><a href='#nameize&#42;'><code>nameize&#42;</code></a> – like <code>nameize</code> but requires symbols to be quoted;</li></ul></li><li><strong><a href='#futils.utils'><code>futils.utils/</code></a></strong><ul><li><a href='#frepeat'><code>frepeat</code></a> – returns a sequence generated by a function that uses named arguments.</li></ul></li></ul></div></div></section><section class="chapter" id="installation"><h2 class="chapter">2 &nbsp;&nbsp; Installation</h2><div class="group"><div class="paragraph"><p>Add dependencies to <code>project.clj</code>:</p><p><code>&#91;pl.randomseed/futils </code>"<code>1.2.2</code>"<code>&#93;</code></p><p>Then (depending on which functions should be used) require it in your program:</p><p><code>&#40;require 'futils.utils&#41;</code><br /> <code>&#40;require 'futils.args&#41;</code><br /> <code>&#40;require 'futils.named&#41;</code><br /></p><p>or:</p><p><code>&#40;ns your-namespace</code><br /> <code> &#40;:require &#91;futils.utils :as utils&#93;&#41;</code><br /> <code> &#40;:require &#91;futils.args  :as args&#93;&#41;</code><br /> <code> &#40;:require &#91;futils.named :as named&#93;&#41;&#41;</code></p></div></div></section><section class="chapter" id="usage"><h2 class="chapter">3 &nbsp;&nbsp; Usage</h2><section class="section" id="futils.args"><h3 class="section">3.1 &nbsp;&nbsp; futils.args</h3><div class="paragraph"><p>The <code>futils.args</code> namespace contains functions that provide positional arguments management, like counting arguments or transforming functions so they can accept variable number of arguments (with optional padding).</p></div><section class="subsection" id="argc"><h4 class="subsection">3.1.1 &nbsp;&nbsp; argc</h4><div class="code"><a name="argc-synopsis"></a><div hljs="hljs" language="clojure" no-escape="no-escape">(futils.args/argc f &amp; options)</div></div><div class="paragraph"><p>Determines the number of arguments that the given function takes and returns a map containing the following keys:</p><ul><li><code>:arities</code> – a sorted sequence containing number of arguments for all arities,</li><li><code>:engine</code>:<ul><li><code>:clj</code> – if metadata were used to determine arities – DEPRECATED);</li><li><code>:jvm</code> – if Java reflection methods were used to determine arities),</li></ul></li><li><code>:macro</code> – a flag informing whether the given object is a macro,</li><li><code>:variadic</code> – a flag informing whether the widest arity is variadic.</li></ul><p>Variadic parameter is counted as one of the possible arguments (if present).</p><p>The macro flag (<code>:macro</code> key with value <code>true</code>) is only present when macro was detected.</p><p>If the given argument cannot be used to obtain a Var bound to a functon or a function object then it returns <code>nil</code>.</p></div><div class="code"><a name="argc-usage"></a><h5>e.3.1 &nbsp;-&nbsp; Using <code>argc</code> on anonymous functions</h5><div hljs="hljs" language="clojure" no-escape="no-escape">(argc (fn ([x y]) ([])))
=&gt; {:arities '(0 2)
:engine :jvm
:variadic false}
Expand Down

0 comments on commit e17f504

Please sign in to comment.