2020-05-30 19:05:05 +00:00
|
|
|
<html>
|
|
|
|
<h1>RPNCalc V4 Public Testing</h1>
|
|
|
|
<p>@ me (aidanprattewart@protonmail.com) if you have any errors, with console output please.</p>
|
|
|
|
<p>
|
|
|
|
Example Programs:
|
|
|
|
<br>
|
|
|
|
<code>(swap; a b -> a b) 1 2 swap</code> N.B. args are in reverse order
|
|
|
|
<br>
|
|
|
|
<code>1 + 2 (v partial -> 'v partial)</code> Evaluate a partial
|
|
|
|
</p>
|
2020-05-30 20:20:04 +00:00
|
|
|
<textarea type="text" id="inbox"></textarea>
|
2020-05-30 19:05:05 +00:00
|
|
|
<button id="submit">execute</button>
|
|
|
|
<p id="outbox"></p>
|
|
|
|
<script src="./main.js" type="module"></script>
|
|
|
|
<p>
|
|
|
|
<h2>Docs</h2>
|
|
|
|
<h3>Lambda/Function Syntax</h3>
|
|
|
|
named function (added to scope, not applied): <code>(swap; a b -> b a)</code>
|
|
|
|
<br>
|
|
|
|
can be called later like: <code>1 2 swap</code>
|
|
|
|
<br>
|
|
|
|
unnamed function, applied immediately: <code>1 2 3 (a b c -> a b c)</code>
|
|
|
|
<br>
|
|
|
|
when lambdas return, they return entire stacks, which are sequentially applied back onto the stack
|
|
|
|
<h3>Partial Application</h3>
|
|
|
|
<code>1 +</code> will push a partially-applied function onto the stack
|
|
|
|
<br>
|
|
|
|
this could be called with: <code>1 + (partial -> 2 partial)</code>
|
|
|
|
<h3>Pairs</h3>
|
|
|
|
pairs of 2 values can be created with <code>pair</code>
|
|
|
|
<br>
|
|
|
|
they can be deconstructed using <code>fst</code> or <code>snd</code>
|
|
|
|
</p>
|
|
|
|
</html>
|