Skip to content

Commit

Permalink
More intro
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin committed Nov 17, 2015
1 parent fbed843 commit 5588bab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions docs/_build/html/_sources/intro.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,14 @@ Now that we've seen examples of each CJam data type, here is a summary of operat
i Convert to integer
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``).

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, i.e. (`permalink <http://cjam.aditsu.net/#code=5%202%20d%20%2F>`__) ::
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

Anothere 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"``.
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"``.

Input and output
----------------
Expand Down
5 changes: 3 additions & 2 deletions docs/_build/html/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,12 @@ <h2>Converting types<a class="headerlink" href="#converting-types" title="Permal
~ Evaluate string/block
</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, i.e. (<a class="reference external" href="http://cjam.aditsu.net/#code=5%202%20d%20%2F">permalink</a>)</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, 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>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
</pre></div>
</div>
<p>Anothere 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>
<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>
</div>
<div class="section" id="input-and-output">
<h2>Input and output<a class="headerlink" href="#input-and-output" title="Permalink to this headline"></a></h2>
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/html/searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5588bab

Please sign in to comment.