Update Pascaligo parentheses in docs

This commit is contained in:
Tom Jack 2019-06-24 08:31:55 -07:00
parent 2f6e17c837
commit 7492657790
5 changed files with 8 additions and 8 deletions

View File

@ -31,7 +31,7 @@ title: Cheat Sheet
|Assignment on an existing variable <br/></br>*⚠️ This feature is not supported at the top-level scope, you can use it e.g. within functions. Works for Records and Maps as well.*| ```age := 18;```, ```p.age := 21``` | |Assignment on an existing variable <br/></br>*⚠️ This feature is not supported at the top-level scope, you can use it e.g. within functions. Works for Records and Maps as well.*| ```age := 18;```, ```p.age := 21``` |
|Annotations| ```("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address)```| |Annotations| ```("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address)```|
|Variants|<pre><code>type action is<br/>&#124; Increment of int<br/>&#124; Decrement of int</code></pre>| |Variants|<pre><code>type action is<br/>&#124; Increment of int<br/>&#124; Decrement of int</code></pre>|
|Variant *(pattern)* matching|<pre><code>const a: action = Increment(5);<br/>case a of<br/>&#124; Increment n -> n + 1<br/>&#124; Decrement n -> n - 1<br/>end</code></pre>| |Variant *(pattern)* matching|<pre><code>const a: action = Increment(5);<br/>case a of<br/>&#124; Increment(n) -> n + 1<br/>&#124; Decrement(n) -> n - 1<br/>end</code></pre>|
|Records|<pre><code>type person is record<br/>&nbsp;&nbsp;age: int ;<br/>&nbsp;&nbsp;name: string ;<br/>end<br/><br/>const john : person = record<br/>&nbsp;&nbsp;age = 18;<br/>&nbsp;&nbsp;name = "John Doe";<br/>end<br/><br/>const name: string = john.name;</code></pre>| |Records|<pre><code>type person is record<br/>&nbsp;&nbsp;age: int ;<br/>&nbsp;&nbsp;name: string ;<br/>end<br/><br/>const john : person = record<br/>&nbsp;&nbsp;age = 18;<br/>&nbsp;&nbsp;name = "John Doe";<br/>end<br/><br/>const name: string = john.name;</code></pre>|
|Maps|<pre><code>type prices is map(nat, tez);<br/><br/>const prices : prices = map<br/>&nbsp;&nbsp;10n -> 60mtz;<br/>&nbsp;&nbsp;50n -> 30mtz;<br/>&nbsp;&nbsp;100n -> 10mtz;<br/>end<br/><br/>const price: option(tez) = prices[50n];</code></pre>| |Maps|<pre><code>type prices is map(nat, tez);<br/><br/>const prices : prices = map<br/>&nbsp;&nbsp;10n -> 60mtz;<br/>&nbsp;&nbsp;50n -> 30mtz;<br/>&nbsp;&nbsp;100n -> 10mtz;<br/>end<br/><br/>const price: option(tez) = prices[50n];</code></pre>|
|Contracts & Accounts|<pre><code>const destinationAddress : address = "tz1...";<br/>const contract : contract(unit) = get_contract(destinationAddress);</code></pre>| |Contracts & Accounts|<pre><code>const destinationAddress : address = "tz1...";<br/>const contract : contract(unit) = get_contract(destinationAddress);</code></pre>|

View File

@ -37,8 +37,8 @@ type action is
function main (const action: action ; const counter: int) : (list(operation) * int) is function main (const action: action ; const counter: int) : (list(operation) * int) is
block {skip} with ((nil : list(operation)), block {skip} with ((nil : list(operation)),
case action of case action of
| Increment number -> counter + number | Increment(number) -> counter + number
| Decrement number -> counter - number | Decrement(number) -> counter - number
end) end)
``` ```

View File

@ -34,8 +34,8 @@ type action is
function main (const p : action ; const s : int) : (list(operation) * int) is function main (const p : action ; const s : int) : (list(operation) * int) is
block {skip} with ((nil : list(operation)), block {skip} with ((nil : list(operation)),
case p of case p of
| Increment n -> s + n | Increment(n) -> s + n
| Decrement n -> s - n | Decrement(n) -> s - n
end) end)
``` ```

View File

@ -40,7 +40,7 @@ class HomeSplash extends React.Component {
<div id="tab-group-3-content-4" className="tab-pane active" data-group="group_3" tabIndex="-1"> <div id="tab-group-3-content-4" className="tab-pane active" data-group="group_3" tabIndex="-1">
<div> <div>
<span> <span>
<pre><code className="hljs css language-Pascal">// variant defining pseudo multi-entrypoint actions<br />type action is<br />| Increment of int<br />| Decrement of int<br /><br />function add (const a : int ; const b : int) : int is<br /> block {'{ skip }'} with a + b<br /><br />function subtract (const a : int ; const b : int) : int is<br /> block {'{ skip }'} with a - b<br /><br />// real entrypoint that re-routes the flow based on the action provided<br />function main (const p : action ; const s : int) : (list(operation) * int) is<br /> block {'{ skip }'} with ((nil : list(operation)),<br /> case p of<br /> | Increment n -&gt; add(s, n)<br /> | Decrement n -&gt; subtract(s, n)<br /> end)<br /></code></pre> <pre><code className="hljs css language-Pascal">// variant defining pseudo multi-entrypoint actions<br />type action is<br />| Increment of int<br />| Decrement of int<br /><br />function add (const a : int ; const b : int) : int is<br /> block {'{ skip }'} with a + b<br /><br />function subtract (const a : int ; const b : int) : int is<br /> block {'{ skip }'} with a - b<br /><br />// real entrypoint that re-routes the flow based on the action provided<br />function main (const p : action ; const s : int) : (list(operation) * int) is<br /> block {'{ skip }'} with ((nil : list(operation)),<br /> case p of<br /> | Increment(n) -&gt; add(s, n)<br /> | Decrement(n) -&gt; subtract(s, n)<br /> end)<br /></code></pre>
</span> </span>
</div> </div>
</div> </div>

View File

@ -13,6 +13,6 @@ function subtract (const a : int ; const b : int) : int is
function main (const p : action ; const s : int) : (list(operation) * int) is function main (const p : action ; const s : int) : (list(operation) * int) is
block {skip} with ((nil : list(operation)), block {skip} with ((nil : list(operation)),
case p of case p of
| Increment (n) -> add (s, n) | Increment(n) -> add(s, n)
| Decrement (n) -> subtract (s, n) | Decrement(n) -> subtract(s, n)
end) end)