Skip to content

Commit

Permalink
Intro
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin committed Nov 17, 2015
1 parent 5588bab commit 90c4018
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/intro.doctree
Binary file not shown.
6 changes: 4 additions & 2 deletions docs/_build/html/_sources/intro.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ Now that we've seen examples of each CJam data type, here is a summary of operat
s Convert to string
~ Evaluate string/block

For example, ``33 c`` converts 33 to its respective ASCII character, ``'!``, and ``'! i`` gives us back 33. Some combinations don't make sense and give an error, such as converting a string to an integer, although counterintuitively it's possible to convert a non-empty string to a character, giving the first char (e.g. ``"abcde" c`` gives ``'a``).
For example, ``33 c`` converts 33 to its respective ASCII character, ``'!``, and ``'! i`` gives us back 33. Some combinations don't make sense and give an error, such as converting a string to an integer. However, counterintuitively, it's possible to convert a non-empty string to a character to give the first char (`permalink <http://cjam.aditsu.net/#code=%22abcde%22%20c>`__): ::

"abcde" c -> 'a

Revisiting the ``5 2 /`` example from earlier, if we already had 5 and 2 on the stack and wanted float division, this means that we can perform ``d`` to convert the 2 to a double before dividing (`permalink <http://cjam.aditsu.net/#code=5%202%20d%20%2F>`__) ::

5 2 d / -> 2.5
5 2 d / -> 2.5

Another note is that backtick ````` and ``s`` differ primarily in how arrays are turned into strings. For example, ``[1 2 3] ``` results in the string ``"[1 2 3]"`` while ``[1 2 3] s`` results in ``"123"``.

Expand Down
7 changes: 5 additions & 2 deletions docs/_build/html/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,12 @@ <h2>Converting types<a class="headerlink" href="#converting-types" title="Permal
~ Evaluate string/block
</pre></div>
</div>
<p>For example, <code class="docutils literal"><span class="pre">33</span> <span class="pre">c</span></code> converts 33 to its respective ASCII character, <code class="docutils literal"><span class="pre">'!</span></code>, and <code class="docutils literal"><span class="pre">'!</span> <span class="pre">i</span></code> gives us back 33. Some combinations don&#8217;t make sense and give an error, such as converting a string to an integer, although counterintuitively it&#8217;s possible to convert a non-empty string to a character, giving the first char (e.g. <code class="docutils literal"><span class="pre">&quot;abcde&quot;</span> <span class="pre">c</span></code> gives <code class="docutils literal"><span class="pre">'a</span></code>).</p>
<p>For example, <code class="docutils literal"><span class="pre">33</span> <span class="pre">c</span></code> converts 33 to its respective ASCII character, <code class="docutils literal"><span class="pre">'!</span></code>, and <code class="docutils literal"><span class="pre">'!</span> <span class="pre">i</span></code> gives us back 33. Some combinations don&#8217;t make sense and give an error, such as converting a string to an integer. However, counterintuitively, it&#8217;s possible to convert a non-empty string to a character to give the first char (<a class="reference external" href="http://cjam.aditsu.net/#code=%22abcde%22%20c">permalink</a>):</p>
<div class="highlight-python"><div class="highlight"><pre>&quot;abcde&quot; c -&gt; &#39;a
</pre></div>
</div>
<p>Revisiting the <code class="docutils literal"><span class="pre">5</span> <span class="pre">2</span> <span class="pre">/</span></code> example from earlier, if we already had 5 and 2 on the stack and wanted float division, this means that we can perform <code class="docutils literal"><span class="pre">d</span></code> to convert the 2 to a double before dividing (<a class="reference external" href="http://cjam.aditsu.net/#code=5%202%20d%20%2F">permalink</a>)</p>
<div class="highlight-python"><div class="highlight"><pre>5 2 d / -&gt; 2.5
<div class="highlight-python"><div class="highlight"><pre>5 2 d / -&gt; 2.5
</pre></div>
</div>
<p>Another note is that backtick <code class="docutils literal"><span class="pre">`</span></code> and <code class="docutils literal"><span class="pre">s</span></code> differ primarily in how arrays are turned into strings. For example, <code class="docutils literal"><span class="pre">[1</span> <span class="pre">2</span> <span class="pre">3]</span> <span class="pre">`</span></code> results in the string <code class="docutils literal"><span class="pre">&quot;[1</span> <span class="pre">2</span> <span class="pre">3]&quot;</span></code> while <code class="docutils literal"><span class="pre">[1</span> <span class="pre">2</span> <span class="pre">3]</span> <span class="pre">s</span></code> results in <code class="docutils literal"><span class="pre">&quot;123&quot;</span></code>.</p>
Expand Down
6 changes: 4 additions & 2 deletions docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ Now that we've seen examples of each CJam data type, here is a summary of operat
s Convert to string
~ Evaluate string/block
For example, ``33 c`` converts 33 to its respective ASCII character, ``'!``, and ``'! i`` gives us back 33. Some combinations don't make sense and give an error, such as converting a string to an integer, although counterintuitively it's possible to convert a non-empty string to a character, giving the first char (e.g. ``"abcde" c`` gives ``'a``).
For example, ``33 c`` converts 33 to its respective ASCII character, ``'!``, and ``'! i`` gives us back 33. Some combinations don't make sense and give an error, such as converting a string to an integer. However, counterintuitively, it's possible to convert a non-empty string to a character to give the first char (`permalink <http://cjam.aditsu.net/#code=%22abcde%22%20c>`__): ::

"abcde" c -> 'a

Revisiting the ``5 2 /`` example from earlier, if we already had 5 and 2 on the stack and wanted float division, this means that we can perform ``d`` to convert the 2 to a double before dividing (`permalink <http://cjam.aditsu.net/#code=5%202%20d%20%2F>`__) ::

5 2 d / -> 2.5
5 2 d / -> 2.5

Another note is that backtick ````` and ``s`` differ primarily in how arrays are turned into strings. For example, ``[1 2 3] ``` results in the string ``"[1 2 3]"`` while ``[1 2 3] s`` results in ``"123"``.

Expand Down

0 comments on commit 90c4018

Please sign in to comment.