-
Notifications
You must be signed in to change notification settings - Fork 0
/
smangler.core.html
22 lines (22 loc) · 9.22 KB
/
smangler.core.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>smangler.core documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="stylesheet" type="text/css" href="css/randomseed.css" /></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Smangler</span> <span class="project-version">1.0.4</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="splitting.html"><div class="inner"><span>Splitting</span></div></a></li><li class="depth-1 "><a href="trimming.html"><div class="inner"><span>Trimming</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>smangler</span></div></div></li><li class="depth-2 branch"><a href="smangler.api.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>api</span></div></a></li><li class="depth-2 current"><a href="smangler.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="smangler.core.html#var-all-prefixes"><div class="inner"><span>all-prefixes</span></div></a></li><li class="depth-1"><a href="smangler.core.html#var-all-subs"><div class="inner"><span>all-subs</span></div></a></li><li class="depth-1"><a href="smangler.core.html#var-all-suffixes"><div class="inner"><span>all-suffixes</span></div></a></li><li class="depth-1"><a href="smangler.core.html#var-trim-both"><div class="inner"><span>trim-both</span></div></a></li><li class="depth-1"><a href="smangler.core.html#var-trim-both-once"><div class="inner"><span>trim-both-once</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">smangler.core</h1><h4 class="added">added in 1.0.0</h4><div class="doc"><div class="markdown"><p>smangler library, core imports.</p>
</div></div><div class="public anchor" id="var-all-prefixes"><h3>all-prefixes</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(all-prefixes p)</code><code>(all-prefixes pred p)</code></div><div class="doc"><div class="markdown"><p>Generates a lazy sequence of all possible prefixes of a given string. Returns nil if nil or an empty string was given as an argument instead of a string.</p>
<p>It automatically converts objects of the following types to strings: characters, numbers, sequences of characters, collections of strings, collections of characters, collections of numbers. For collections it joins the elements converted to strings.</p>
<p>The resulting sequence will contain the whole string on its last position.</p>
<p>If two arguments are given the first one should be a function used to partition the given string. It should take a single character and return an object. The given string will be split whenever this function will return new value. That way the suffixes will be generated for parts of the string instead of separate characters.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/smangler/tree/1.0.4/src/smangler/core.clj#L104">view source</a></div></div><div class="public anchor" id="var-all-subs"><h3>all-subs</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(all-subs pred p)</code><code>(all-subs p)</code></div><div class="doc"><div class="markdown"><p>Generates a lazy sequence of all possible substrings (prefixes, suffixes and infixes) of a given string. Returns nil if nil or an empty string was given as an argument instead of a string.</p>
<p>The resulting sequence will contain the whole string in its middle. Moreover, the substrings will not be unique across the sequence if the characters are repeating in the input.</p>
<p>If two arguments are given the first one should be a function used to partition the given string. It should take a single character and return an object. The given string will be split whenever this function will return new value. That way the substrings will be generated for parts of the string instead of separate characters.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/smangler/tree/1.0.4/src/smangler/core.clj#L130">view source</a></div></div><div class="public anchor" id="var-all-suffixes"><h3>all-suffixes</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(all-suffixes p)</code><code>(all-suffixes pred p)</code></div><div class="doc"><div class="markdown"><p>Generates a lazy sequence of all possible suffixes of a given string. Returns nil if nil or an empty string was given as an argument instead of a string.</p>
<p>The resulting sequence will contain the whole string on its first position.</p>
<p>If two arguments are given the first one should be a function used to partition the given string. It should take a single character and return an object. The given string will be split whenever this function will return new value. That way the prefixes will be generated for parts of the string instead of separate characters.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/smangler/tree/1.0.4/src/smangler/core.clj#L87">view source</a></div></div><div class="public anchor" id="var-trim-both"><h3>trim-both</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(trim-both p)</code><code>(trim-both matcher p)</code><code>(trim-both start end p)</code></div><div class="doc"><div class="markdown"><p>Takes a string and recursively trims its first and last character if they are equal. Returns a new string or nil when nil was passed as an argument instead of a string. For an empty string it returns an empty string.</p>
<p>When the matcher argument is present it specifies a matching function used to decide whether to trim first and last character. The given function should take a character and make a lookup to decide whether a character should be trimmed from the beginning of a string. Additionally, its returned value (if a character) is then used to match the last character of the string. Therefore the returned value should be a character (the same or different as passed), nil or false (to indicate a failed match). The trimming function will trim a string on both ends if a value returned by the matcher is equal to the last character of this string. It’s common to use a set (to match the same characters on both ends) or a map (to match different characters).</p>
<p>When 3 arguments are given the first two should be characters used to match first and last character of a trimmed string (given as third argument).</p>
<p>When the string consist of 2 matching letters the result will be an empty string.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/smangler/tree/1.0.4/src/smangler/core.clj#L41">view source</a></div></div><div class="public anchor" id="var-trim-both-once"><h3>trim-both-once</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(trim-both-once p)</code><code>(trim-both-once matcher p)</code><code>(trim-both-once start end p)</code></div><div class="doc"><div class="markdown"><p>Takes a string and trims its first and last character if they are equal. Returns a new string or nil when there is nothing to trim or nil was passed as an argument instead of a string. For an empty string it also returns nil.</p>
<p>When the matcher argument is present it specifies a matching function used to decide whether to trim first and last character. The given function should take a character and make a lookup to decide whether a character should be trimmed from the beginning of a string. Additionally, its returned value (if a character) is then used to match the last character of the string. Therefore the returned value should be a character (the same or different as passed), nil or false (to indicate a failed match). The trimming function will trim a string on both ends if a value returned by the matcher is equal to the last character of this string. It’s common to use a set (to match the same characters on both ends) or a map (to match different characters).</p>
<p>When 3 arguments are given the first two should be characters used to match first and last character of a trimmed string (given as third argument).</p>
<p>When the string consist of 2 matching letters the result will be an empty string.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/smangler/tree/1.0.4/src/smangler/core.clj#L14">view source</a></div></div></div></body></html>