@graffiticode/basis 1.6.2 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/spec/spec.html CHANGED
@@ -7,13 +7,56 @@
7
7
  <script>(function(){var r,a=[];document.addEventListener("readystatechange",function(){document.readyState==="interactive"&&u()});function u(){var n=document.querySelector('label[for="spec-sidebar-toggle"]');n.addEventListener("scroll",o),n.addEventListener("touchmove",o);function o(d){d.preventDefault()}for(var t=document.getElementsByTagName("section"),e=0;e<t.length;e++)t[e].getAttribute("secid")&&a.push(t[e]);var i=window.scrollY,c=!1;window.addEventListener("scroll",function(d){i=window.scrollY,c||(c=!0,window.requestAnimationFrame(function(){s(i),c=!1}))})}function s(n){for(var o=n+document.documentElement.clientHeight/4,t,e=a.length-1;e>=0;e--)if(a[e].offsetTop<o){t=a[e];break}var i=t&&t.getAttribute("secid");i!==r&&(r&&l(r,!1),i&&l(i,!0),r=i)}function l(n,o){document.getElementById("_sidebar_"+n).className=o?"viewing":"";for(var t=n.split(".");t.length;){var e=document.getElementById("_toggle_"+t.join("."));e&&(e.checked=o),t.pop()}}s(window.scrollY);})();</script>
8
8
  <script>(function(){var n=document.getElementsByTagName("style")[0].sheet,e;function u(){e&&(n.deleteRule(e),e=void 0)}function d(t){u(),e=n.insertRule('*[data-name="'+t+'"] { background: rgba(230,215,0,0.12); }',n.cssRules.length)}document.documentElement.addEventListener("mouseover",function(t){var a=t.target.attributes["data-name"];a&&d(a.value)});document.documentElement.addEventListener("mouseout",u);})();</script>
9
9
  <script>(function(){var R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",o,p,r,g;document.addEventListener("selectionchange",E);window.addEventListener("resize",C);window.addEventListener("hashchange",x);window.addEventListener("load",x);function S(n){y(new URL(n.target.href))}function x(){y(window.location)}function y(n){var e=n.hash.match(/^#sel-([A-Za-z0-9-_]+)$/);if(!!e){g=e[1],r=k(g);var t=r.getBoundingClientRect(),d=Math.max(20,Math.floor((window.innerHeight-t.height)*.4));window.scrollTo(0,window.scrollY+t.y-d);var c=document.getSelection();c.empty(),c.addRange(r),C()}}function E(n){var e=document.getSelection();if(e.isCollapsed)o&&(o.parentNode.removeChild(o),o=null);else{var t=e.getRangeAt(0);(!r||t.compareBoundaryPoints(Range.START_TO_START,r)!==0||t.compareBoundaryPoints(Range.END_TO_END,r)!==0)&&(r=t,g=B(r),C())}}function C(){if(!!r){p||(p=document.getElementsByTagName("article")[0]),o||(o=document.createElement("a"),document.body.appendChild(o)),o.href="#sel-"+g,o.onclick=S,o.className=r.isOutdated?"outdated-selection-link":"selection-link",o.innerText=r.isOutdated?"!":"\u201F";var n=window.innerWidth<720,e=r.getBoundingClientRect();if(n)o.style.left=Math.floor(e.x+e.width/2+window.scrollX-13)+"px",o.style.top=Math.floor(e.bottom+window.scrollY+10)+"px";else{var t=p.getBoundingClientRect().x;o.style.left=Math.floor(t+window.scrollX-37)+"px",o.style.top=Math.floor(e.y+window.scrollY-3)+"px"}}}function B(n){var e="",t=N(n.startContainer),d=N(n.endContainer),c=M(t,d);return l(c),l(t.slice(c.length).concat(n.startOffset)),l(d.slice(c.length).concat(n.endOffset)),i(L(n.toString())),e;function i(a){do e+=R[a&31|(a>31?32:0)],a>>=5;while(a>0)}function l(a){i(a.length);for(var h=0;h<a.length;h++)i(a[h])}}function k(n){for(var e=new Array(64),t=0;t<64;t++)e[R.charCodeAt(t)]=t;var d=0,c=m(),i=m(),l=m(),a=w(),h=i.pop(),P=O(c.concat(i)),T=l.pop(),A=O(c.concat(l)),u=document.createRange();return u.setStart(P,h),u.setEnd(A,T),u.isOutdated=a!==void 0&&a!==L(u.toString()),u;function w(){for(var s=0,v=0;d<n.length;){var f=e[n.charCodeAt(d++)];if(s|=(f&31)<<v,v+=5,f<32)return s}}function m(){var s=w();if(s!=null){for(var v=new Array(s),f=0;f<s;f++)v[f]=w();return v}}}function N(n){for(var e=[];n!=document.body;){var t=n.parentNode;e.push(Array.prototype.indexOf.call(t.childNodes,n)),n=t}return e.reverse()}function O(n){for(var e=document.body,t=0;t<n.length&&e;t++)e=e.childNodes[n[t]];return e}function M(n,e){for(var t=0;t<n.length&&t<e.length&&n[t]===e[t];)t++;return n.slice(0,t)}function L(n){for(var e=2166136261,t=0;t<n.length;++t)e^=n.charCodeAt(t),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return(e>>15^e)&32767}})();</script>
10
- </head>
10
+
11
+ <style>
12
+ pre {
13
+ position: relative;
14
+ }
15
+ .copy-button {
16
+ position: absolute;
17
+ top: 6px;
18
+ right: 6px;
19
+ padding: 3px 8px;
20
+ border: 1px solid var(--color-pre-border);
21
+ border-radius: 4px;
22
+ background: var(--color-background);
23
+ color: var(--color-grey);
24
+ font-family: var(--font-family);
25
+ font-size: 12px;
26
+ cursor: pointer;
27
+ opacity: 0;
28
+ transition: opacity 0.15s;
29
+ }
30
+ pre:hover .copy-button {
31
+ opacity: 1;
32
+ }
33
+ .copy-button:hover {
34
+ background: var(--color-pre-border);
35
+ }
36
+ </style>
37
+ <script>
38
+ document.addEventListener("DOMContentLoaded", function () {
39
+ document.querySelectorAll("pre > code").forEach(function (code) {
40
+ var pre = code.parentElement;
41
+ var btn = document.createElement("button");
42
+ btn.className = "copy-button";
43
+ btn.textContent = "Copy";
44
+ btn.addEventListener("click", function () {
45
+ navigator.clipboard.writeText(code.textContent).then(function () {
46
+ btn.textContent = "Copied!";
47
+ setTimeout(function () { btn.textContent = "Copy"; }, 1500);
48
+ });
49
+ });
50
+ pre.appendChild(btn);
51
+ });
52
+ });
53
+ </script></head>
11
54
  <body><article>
12
55
  <header>
13
56
  <h1>Graffiticode Core Language Specification</h1>
14
57
  <section id="intro">
15
- <pre><code>Version: 0.1.0
16
- Date: 2025-04-30
58
+ <pre><code>Version: 0.1.2
59
+ Date: 2026-01-26
17
60
  </code></pre>
18
61
  </section>
19
62
  <nav class="spec-toc">
@@ -31,53 +74,66 @@ Date: 2025-04-30
31
74
  <li><a href="#sec-Function-Application"><span class="spec-secid">3.2.1</span>Function Application</a></li>
32
75
  <li><a href="#sec-Lists"><span class="spec-secid">3.2.2</span>Lists</a></li>
33
76
  <li><a href="#sec-Records"><span class="spec-secid">3.2.3</span>Records</a></li>
34
- <li><a href="#sec-Lambdas"><span class="spec-secid">3.2.4</span>Lambdas</a></li>
35
- <li><a href="#sec-Let-Bindings"><span class="spec-secid">3.2.5</span>Let Bindings</a></li>
77
+ <li><a href="#sec-Tags"><span class="spec-secid">3.2.4</span>Tags</a></li>
78
+ <li><a href="#sec-Lambdas"><span class="spec-secid">3.2.5</span>Lambdas</a></li>
79
+ <li><a href="#sec-Let-Bindings"><span class="spec-secid">3.2.6</span>Let Bindings</a></li>
36
80
  </ol>
37
81
  </li>
38
- <li><a href="#sec-Pattern-Matching"><span class="spec-secid">3.3</span>Pattern Matching</a><ol>
39
- <li><a href="#sec-Tag-Values"><span class="spec-secid">3.3.1</span>Tag Values</a></li>
82
+ <li><a href="#sec-Pattern-Matching"><span class="spec-secid">3.3</span>Pattern Matching</a></li>
40
83
  </ol>
41
84
  </li>
85
+ <li><a href="#sec-Type-System"><span class="spec-secid">4</span>Type System</a><ol>
86
+ <li><a href="#sec-Primitive-Types"><span class="spec-secid">4.1</span>Primitive Types</a></li>
87
+ <li><a href="#sec-Composite-Types"><span class="spec-secid">4.2</span>Composite Types</a></li>
88
+ <li><a href="#sec-Function-Types"><span class="spec-secid">4.3</span>Function Types</a></li>
89
+ <li><a href="#sec-Tag-Sets-and-Tag-Value-Type"><span class="spec-secid">4.4</span>Tag Sets and Tag Value Type</a><ol>
90
+ <li><a href="#sec-Tag-Identity-and-Type"><span class="spec-secid">4.4.1</span>Tag Identity and Type</a></li>
91
+ <li><a href="#sec-Tag-Sets-as-Structural-Types"><span class="spec-secid">4.4.2</span>Tag Sets as Structural Types</a></li>
92
+ <li><a href="#sec-Default-Type-tag-"><span class="spec-secid">4.4.3</span>Default Type: `tag`</a></li>
93
+ <li><a href="#sec-Example"><span class="spec-secid">4.4.4</span>Example</a></li>
42
94
  </ol>
43
95
  </li>
44
- <li><a href="#sec-Semantics"><span class="spec-secid">4</span>Semantics</a><ol>
45
- <li><a href="#sec-Evaluation-Model"><span class="spec-secid">4.1</span>Evaluation Model</a></li>
46
- <li><a href="#sec-Functions"><span class="spec-secid">4.2</span>Functions</a></li>
47
- <li><a href="#sec-Scoping"><span class="spec-secid">4.3</span>Scoping</a></li>
48
- <li><a href="#sec-Errors"><span class="spec-secid">4.4</span>Errors</a></li>
96
+ <li><a href="#sec-Example-Annotated-Definitions"><span class="spec-secid">4.5</span>Example: Annotated Definitions</a></li>
49
97
  </ol>
50
98
  </li>
51
- <li><a href="#sec-Base-Library"><span class="spec-secid">5</span>Base Library</a><ol>
52
- <li><a href="#sec-Types"><span class="spec-secid">5.1</span>Types</a></li>
53
- <li><a href="#sec-Built-in-Functions"><span class="spec-secid">5.2</span>Built-in Functions</a><ol>
54
- <li><a href="#sec-add"><span class="spec-secid">5.2.1</span>add</a></li>
55
- <li><a href="#sec-and"><span class="spec-secid">5.2.2</span>and</a></li>
56
- <li><a href="#sec-apply"><span class="spec-secid">5.2.3</span>apply</a></li>
57
- <li><a href="#sec-div"><span class="spec-secid">5.2.4</span>div</a></li>
58
- <li><a href="#sec-equiv"><span class="spec-secid">5.2.5</span>equiv</a></li>
59
- <li><a href="#sec-filter"><span class="spec-secid">5.2.6</span>filter</a></li>
60
- <li><a href="#sec-get"><span class="spec-secid">5.2.7</span>get</a></li>
61
- <li><a href="#sec-hd"><span class="spec-secid">5.2.8</span>hd</a></li>
62
- <li><a href="#sec-isEmpty"><span class="spec-secid">5.2.9</span>isEmpty</a></li>
63
- <li><a href="#sec-map"><span class="spec-secid">5.2.10</span>map</a></li>
64
- <li><a href="#sec-max"><span class="spec-secid">5.2.11</span>max</a></li>
65
- <li><a href="#sec-min"><span class="spec-secid">5.2.12</span>min</a></li>
66
- <li><a href="#sec-mod"><span class="spec-secid">5.2.13</span>mod</a></li>
67
- <li><a href="#sec-mul"><span class="spec-secid">5.2.14</span>mul</a></li>
68
- <li><a href="#sec-not"><span class="spec-secid">5.2.15</span>not</a></li>
69
- <li><a href="#sec-nth"><span class="spec-secid">5.2.16</span>nth</a></li>
70
- <li><a href="#sec-or"><span class="spec-secid">5.2.17</span>or</a></li>
71
- <li><a href="#sec-range"><span class="spec-secid">5.2.18</span>range</a></li>
72
- <li><a href="#sec-reduce"><span class="spec-secid">5.2.19</span>reduce</a></li>
73
- <li><a href="#sec-set"><span class="spec-secid">5.2.20</span>set</a></li>
74
- <li><a href="#sec-sub"><span class="spec-secid">5.2.21</span>sub</a></li>
75
- <li><a href="#sec-tl"><span class="spec-secid">5.2.22</span>tl</a></li>
99
+ <li><a href="#sec-Semantics"><span class="spec-secid">5</span>Semantics</a><ol>
100
+ <li><a href="#sec-Evaluation-Model"><span class="spec-secid">5.1</span>Evaluation Model</a></li>
101
+ <li><a href="#sec-Functions"><span class="spec-secid">5.2</span>Functions</a></li>
102
+ <li><a href="#sec-Scoping"><span class="spec-secid">5.3</span>Scoping</a></li>
103
+ <li><a href="#sec-Errors"><span class="spec-secid">5.4</span>Errors</a></li>
76
104
  </ol>
77
105
  </li>
106
+ <li><a href="#sec-Base-Library"><span class="spec-secid">6</span>Base Library</a><ol>
107
+ <li><a href="#sec-Types"><span class="spec-secid">6.1</span>Types</a></li>
108
+ <li><a href="#sec-Built-in-Functions"><span class="spec-secid">6.2</span>Built-in Functions</a><ol>
109
+ <li><a href="#sec-add"><span class="spec-secid">6.2.1</span>add</a></li>
110
+ <li><a href="#sec-and"><span class="spec-secid">6.2.2</span>and</a></li>
111
+ <li><a href="#sec-apply"><span class="spec-secid">6.2.3</span>apply</a></li>
112
+ <li><a href="#sec-div"><span class="spec-secid">6.2.4</span>div</a></li>
113
+ <li><a href="#sec-equiv"><span class="spec-secid">6.2.5</span>equiv</a></li>
114
+ <li><a href="#sec-filter"><span class="spec-secid">6.2.6</span>filter</a></li>
115
+ <li><a href="#sec-get"><span class="spec-secid">6.2.7</span>get</a></li>
116
+ <li><a href="#sec-hd"><span class="spec-secid">6.2.8</span>hd</a></li>
117
+ <li><a href="#sec-isEmpty"><span class="spec-secid">6.2.9</span>isEmpty</a></li>
118
+ <li><a href="#sec-log"><span class="spec-secid">6.2.10</span>log</a></li>
119
+ <li><a href="#sec-map"><span class="spec-secid">6.2.11</span>map</a></li>
120
+ <li><a href="#sec-max"><span class="spec-secid">6.2.12</span>max</a></li>
121
+ <li><a href="#sec-min"><span class="spec-secid">6.2.13</span>min</a></li>
122
+ <li><a href="#sec-mod"><span class="spec-secid">6.2.14</span>mod</a></li>
123
+ <li><a href="#sec-mul"><span class="spec-secid">6.2.15</span>mul</a></li>
124
+ <li><a href="#sec-not"><span class="spec-secid">6.2.16</span>not</a></li>
125
+ <li><a href="#sec-nth"><span class="spec-secid">6.2.17</span>nth</a></li>
126
+ <li><a href="#sec-or"><span class="spec-secid">6.2.18</span>or</a></li>
127
+ <li><a href="#sec-range"><span class="spec-secid">6.2.19</span>range</a></li>
128
+ <li><a href="#sec-reduce"><span class="spec-secid">6.2.20</span>reduce</a></li>
129
+ <li><a href="#sec-set"><span class="spec-secid">6.2.21</span>set</a></li>
130
+ <li><a href="#sec-sub"><span class="spec-secid">6.2.22</span>sub</a></li>
131
+ <li><a href="#sec-tl"><span class="spec-secid">6.2.23</span>tl</a></li>
78
132
  </ol>
79
133
  </li>
80
- <li><a href="#sec-Program-Examples"><span class="spec-secid">6</span>Program Examples</a></li>
134
+ </ol>
135
+ </li>
136
+ <li><a href="#sec-Program-Examples"><span class="spec-secid">7</span>Program Examples</a></li>
81
137
  <li><a href="#index"><span class="spec-secid">§</span>Index</a></li>
82
138
  </ol>
83
139
  </nav>
@@ -119,6 +175,7 @@ map (double) [1 2 3]..
119
175
  <section id="sec-Function-Application" secid="3.2.1">
120
176
  <h3><span class="spec-secid" title="link to this section"><a href="#sec-Function-Application">3.2.1</a></span>Function Application</h3>
121
177
  <p>Function application is written in prefix style: <code>add 1 2</code></p>
178
+ <p>Functions have fixed arity, so applications can be parsed unambiguously without grouping syntax. For example, <code>add 1 mul 2 3</code> parses as <code>add(1, mul(2, 3))</code> because the parser knows <code>add</code> takes 2 arguments and <code>mul</code> takes 2 arguments.</p>
122
179
  <p>Parentheses are used to defer application: <code>map (double) [1 2 3]</code></p>
123
180
  </section>
124
181
  <section id="sec-Lists" secid="3.2.2">
@@ -128,24 +185,60 @@ map (double) [1 2 3]..
128
185
  </section>
129
186
  <section id="sec-Records" secid="3.2.3">
130
187
  <h3><span class="spec-secid" title="link to this section"><a href="#sec-Records">3.2.3</a></span>Records</h3>
131
- <pre><code>{ name: "Alice", age: 30 }
188
+ <p>Records may use <strong>shorthand syntax</strong> for fields where the value is a reference to a variable of the same name.</p>
189
+ <pre data-language="gc"><code>let foo = 10..
190
+ {foo} | equivalent to {foo: 10}
191
+ </code></pre>
192
+ <p>This provides a concise way to construct records using in-scope variable names as field keys and values.</p>
193
+ <p>You can also mix shorthand and explicit fields:</p>
194
+ <pre data-language="gc"><code>let x = 1..
195
+ let y = 2..
196
+ {x y z: 3} | equivalent to {x: 1, y: 2, z: 3}
197
+ </code></pre>
198
+ <pre data-language="gc"><code>{ name: "Alice", age: 30 }
199
+ </code></pre>
200
+ </section>
201
+ <section id="sec-Tags" secid="3.2.4">
202
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-Tags">3.2.4</a></span>Tags</h3>
203
+ <p>A <strong>tag value</strong> is an arity-0 symbolic value used to represent symbolic variants in pattern matching or other symbolic forms.</p>
204
+ <p>Tag values are <strong>only defined</strong> by using record shorthand syntax. For example:</p>
205
+ <pre data-language="gc"><code>{red blue green} | defines the tag values red, blue, and green
206
+ </code></pre>
207
+ <p>Tag values:</p>
208
+ <ul>
209
+ <li>Must be introduced via record shorthand notation</li>
210
+ <li>Are resolved as symbolic constants with identity semantics</li>
211
+ <li>Match directly in <code>case</code> expressions:</li>
212
+ </ul>
213
+ <pre><code>let color = get "red" {red blue green}
214
+ case color of
215
+ red: "warm"
216
+ blue: "cool"
217
+ _: "other"
218
+ end
132
219
  </code></pre>
133
220
  </section>
134
- <section id="sec-Lambdas" secid="3.2.4">
135
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-Lambdas">3.2.4</a></span>Lambdas</h3>
221
+ <section id="sec-Lambdas" secid="3.2.5">
222
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-Lambdas">3.2.5</a></span>Lambdas</h3>
136
223
  <pre><code>&lt;x: add x 1&gt;
137
224
  </code></pre>
138
225
  <p>Multiple parameters: <code>&lt;x y: add x y&gt;</code></p>
139
226
  </section>
140
- <section id="sec-Let-Bindings" secid="3.2.5">
141
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-Let-Bindings">3.2.5</a></span>Let Bindings</h3>
227
+ <section id="sec-Let-Bindings" secid="3.2.6">
228
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-Let-Bindings">3.2.6</a></span>Let Bindings</h3>
142
229
  <pre><code>let double = &lt;x: mul 2 x&gt;..
143
230
  </code></pre>
144
231
  </section>
145
232
  </section>
146
233
  <section id="sec-Pattern-Matching" secid="3.3">
147
234
  <h2><span class="spec-secid" title="link to this section"><a href="#sec-Pattern-Matching">3.3</a></span>Pattern Matching</h2>
148
- <p>Pattern matching is done using <code>case</code>: <code>case x of 0: "zero" 1: "one" _: "other" end</code></p>
235
+ <p>Pattern matching is done using <code>case</code>:</p>
236
+ <pre><code>case x of
237
+ 0: "zero"
238
+ 1: "one"
239
+ _: "other"
240
+ end
241
+ </code></pre>
149
242
  <div class="spec-production" id="Supports">
150
243
  <span class="spec-nt"><a href="#Supports" data-name="Supports">Supports</a></span><div class="spec-rhs"><span class="spec-nt"><span data-name="Literal">Literal</span></span><span class="spec-t">values</span></div>
151
244
  <div class="spec-rhs"><span class="spec-nt"><span data-name="Tuple">Tuple</span></span><span class="spec-t">destructuring:</span><span class="spec-t">(a, b)</span></div>
@@ -153,31 +246,90 @@ map (double) [1 2 3]..
153
246
  <div class="spec-rhs"><span class="spec-nt"><span data-name="Wildcard">Wildcard</span></span><span class="spec-t">_</span></div>
154
247
  </div>
155
248
  <p>Pattern matching on function arguments is disallowed.</p>
156
- <section id="sec-Tag-Values" secid="3.3.1">
157
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-Tag-Values">3.3.1</a></span>Tag Values</h3>
158
- <p>A <strong>tag value</strong> is an arity-0 symbolic value that can be used in pattern matching or to encode variant types.</p>
159
- <pre><code>red
160
- </code></pre>
161
- <p>Tag values:</p>
249
+ </section>
250
+ </section>
251
+ <section id="sec-Type-System" secid="4">
252
+ <h1><span class="spec-secid" title="link to this section"><a href="#sec-Type-System">4</a></span>Type System</h1>
253
+ <p>Graffiticode includes a implicit structural type system. Every expression has a statically inferred type, and type errors are detected at compile time. Explicit type annotations are not included in the grammar.</p>
254
+ <section id="sec-Primitive-Types" secid="4.1">
255
+ <h2><span class="spec-secid" title="link to this section"><a href="#sec-Primitive-Types">4.1</a></span>Primitive Types</h2>
162
256
  <ul>
163
- <li>Are unbound identifiers that appear in expression position.</li>
164
- <li>May optionally be introduced via implicit enum definitions.</li>
165
- <li>Match directly in <code>case</code> expressions:</li>
257
+ <li><code>number</code> &ndash; Represents integers or floating-point numbers.</li>
258
+ <li><code>string</code> &ndash; Represents UTF-8 strings.</li>
259
+ <li><code>bool</code> &ndash; Represents Boolean values: <code>true</code> and <code>false</code>.</li>
260
+ <li><code>json</code> &ndash; Represents any JSON-compatible value (opaque, untyped).</li>
261
+ <li><code>any</code> &ndash; Used internally to denote an unconstrained type (e.g., during inference).</li>
262
+ </ul>
263
+ </section>
264
+ <section id="sec-Composite-Types" secid="4.2">
265
+ <h2><span class="spec-secid" title="link to this section"><a href="#sec-Composite-Types">4.2</a></span>Composite Types</h2>
266
+ <ul>
267
+ <li><strong>Lists</strong> &ndash; Written as <code>[T]</code> where <code>T</code> is any type. <code> [string] | list of strings [number] | list of numbers [[bool]] | list of lists of booleans </code></li>
268
+ <li><strong>Records</strong> &ndash; Key-value maps with known keys and types. <code> { name: string, age: number } </code></li>
269
+ <li><strong>Tuples</strong> &ndash; Ordered, fixed-length collections with heterogeneous types. <code> (number, string, bool) </code></li>
166
270
  </ul>
167
- <pre><code>case color of
271
+ </section>
272
+ <section id="sec-Function-Types" secid="4.3">
273
+ <h2><span class="spec-secid" title="link to this section"><a href="#sec-Function-Types">4.3</a></span>Function Types</h2>
274
+ <p>Functions are written using Graffiticode lambda signature syntax: <code>&lt;number number: number&gt; | function taking two numbers and returning a number &lt;string: [string]&gt; | function taking a string and returning a list of strings &lt;list record: record&gt; | common signature for structural transformation</code></p>
275
+ <p>Function types are curried by default. That means: <code>&lt;number number: number&gt;</code> is equivalent to a function that returns another function: <code>&lt;number: &lt;number: number&gt;&gt;</code></p>
276
+ </section>
277
+ <section id="sec-Tag-Sets-and-Tag-Value-Type" secid="4.4">
278
+ <h2><span class="spec-secid" title="link to this section"><a href="#sec-Tag-Sets-and-Tag-Value-Type">4.4</a></span>Tag Sets and Tag Value Type</h2>
279
+ <p>Tag values are symbolic constants introduced using record shorthand syntax. They have a default type of <code>tag</code>, and their identity is preserved across bindings.</p>
280
+ <section id="sec-Tag-Identity-and-Type" secid="4.4.1">
281
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-Tag-Identity-and-Type">4.4.1</a></span>Tag Identity and Type</h3>
282
+ <p>Tag values are symbolic constants identified <strong>solely by their name</strong>. The same tag name (e.g., <code>A</code>) refers to the same symbolic value, regardless of where it is defined.</p>
283
+ <p>Tag values compare equal by name. For example, <code>A</code> in <code>{A B}</code> and <code>A</code> in <code>{A C}</code> are equal.</p>
284
+ </section>
285
+ <section id="sec-Tag-Sets-as-Structural-Types" secid="4.4.2">
286
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-Tag-Sets-as-Structural-Types">4.4.2</a></span>Tag Sets as Structural Types</h3>
287
+ <p>Although tag values are globally identified by name, the <strong>type system tracks which tags are expected to co-occur</strong>.</p>
288
+ <p>For example, <code>{A B}</code> and <code>{A C}</code> are different types:</p>
289
+ <pre><code>{A B} | type: { A: tag, B: tag }
290
+ {A C} | type: { A: tag, C: tag }
291
+ </code></pre>
292
+ <p>This allows the type system to constrain the expected context for pattern matching, record shapes, or enum-style uses of tags.</p>
293
+ <p>Using tags not part of the expected set results in a type error.</p>
294
+ </section>
295
+ <section id="sec-Default-Type-tag-" secid="4.4.3">
296
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-Default-Type-tag-">4.4.3</a></span>Default Type: `tag`</h3>
297
+ <p>By default, a tag value has the type:</p>
298
+ <pre data-language="gc"><code>tag
299
+ </code></pre>
300
+ <p>When tags are introduced with:</p>
301
+ <pre><code>{A B C}
302
+ </code></pre>
303
+ <p>the resulting type is:</p>
304
+ <pre><code>{ A: tag, B: tag, C: tag }
305
+ </code></pre>
306
+ <p>This allows for composition and safe comparison.</p>
307
+ </section>
308
+ <section id="sec-Example" secid="4.4.4">
309
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-Example">4.4.4</a></span>Example</h3>
310
+ <pre data-language="gc"><code>let colors = {red blue green}..
311
+ case red of
168
312
  red: "warm"
169
313
  blue: "cool"
170
314
  _: "other"
171
315
  end
172
316
  </code></pre>
173
- <p>Tags are resolved as special constants with symbolic identity. They are case-sensitive and may be compared for equality using regular pattern match semantics.</p>
317
+ <p>In this case, <code>red</code>, <code>blue</code>, and <code>green</code> are all of type <code>tag</code>, and <code>case</code> matches by identity.</p>
174
318
  </section>
175
319
  </section>
320
+ <section id="sec-Example-Annotated-Definitions" secid="4.5">
321
+ <h2><span class="spec-secid" title="link to this section"><a href="#sec-Example-Annotated-Definitions">4.5</a></span>Example: Annotated Definitions</h2>
322
+ <pre data-language="gc"><code>let inc = &lt;x: add x 1&gt; | type: &lt;number: number&gt;
323
+ let greet = &lt;name: concat ["Hello, " name]&gt; | type: &lt;string: string&gt;
324
+ let zip = &lt;xs ys: zipLists xs ys&gt; | type: &lt;[T] [U]: [(T, U)]&gt;
325
+ </code></pre>
326
+ <p>(Note: actual Graffiticode does not use type annotations in <code>let</code> bindings; types are inferred.)</p>
176
327
  </section>
177
- <section id="sec-Semantics" secid="4">
178
- <h1><span class="spec-secid" title="link to this section"><a href="#sec-Semantics">4</a></span>Semantics</h1>
179
- <section id="sec-Evaluation-Model" secid="4.1">
180
- <h2><span class="spec-secid" title="link to this section"><a href="#sec-Evaluation-Model">4.1</a></span>Evaluation Model</h2>
328
+ </section>
329
+ <section id="sec-Semantics" secid="5">
330
+ <h1><span class="spec-secid" title="link to this section"><a href="#sec-Semantics">5</a></span>Semantics</h1>
331
+ <section id="sec-Evaluation-Model" secid="5.1">
332
+ <h2><span class="spec-secid" title="link to this section"><a href="#sec-Evaluation-Model">5.1</a></span>Evaluation Model</h2>
181
333
  <ul>
182
334
  <li><strong>Purely functional</strong>: no side effects</li>
183
335
  <li><strong>Strict evaluation</strong>: arguments evaluated before function application</li>
@@ -187,22 +339,22 @@ end
187
339
  <p>This style enables a declarative and order-independent composition of functions. Since each function call returns a new model, multiple calls can be reordered without changing the final result, provided the functional dependencies are preserved.</p>
188
340
  <p>This approach draws inspiration from <strong>Model-View-Update</strong> (MVU) architectures, in which the model represents the application state and functions describe pure, deterministic transformations of that state.</p>
189
341
  </section>
190
- <section id="sec-Functions" secid="4.2">
191
- <h2><span class="spec-secid" title="link to this section"><a href="#sec-Functions">4.2</a></span>Functions</h2>
342
+ <section id="sec-Functions" secid="5.2">
343
+ <h2><span class="spec-secid" title="link to this section"><a href="#sec-Functions">5.2</a></span>Functions</h2>
192
344
  <ul>
193
345
  <li><strong>Fixed arity</strong>: every function has a known number of parameters</li>
194
346
  <li><strong>Curried by default</strong>: partial application supported</li>
195
347
  </ul>
196
348
  </section>
197
- <section id="sec-Scoping" secid="4.3">
198
- <h2><span class="spec-secid" title="link to this section"><a href="#sec-Scoping">4.3</a></span>Scoping</h2>
349
+ <section id="sec-Scoping" secid="5.3">
350
+ <h2><span class="spec-secid" title="link to this section"><a href="#sec-Scoping">5.3</a></span>Scoping</h2>
199
351
  <ul>
200
352
  <li><strong>Lexical scoping</strong></li>
201
353
  <li><strong>Shadowing</strong> allowed within nested scopes</li>
202
354
  </ul>
203
355
  </section>
204
- <section id="sec-Errors" secid="4.4">
205
- <h2><span class="spec-secid" title="link to this section"><a href="#sec-Errors">4.4</a></span>Errors</h2>
356
+ <section id="sec-Errors" secid="5.4">
357
+ <h2><span class="spec-secid" title="link to this section"><a href="#sec-Errors">5.4</a></span>Errors</h2>
206
358
  <ul>
207
359
  <li><strong>Syntax errors</strong>: raised during parsing</li>
208
360
  <li><strong>Type errors</strong>: raised during compilation</li>
@@ -210,10 +362,10 @@ end
210
362
  </ul>
211
363
  </section>
212
364
  </section>
213
- <section id="sec-Base-Library" secid="5">
214
- <h1><span class="spec-secid" title="link to this section"><a href="#sec-Base-Library">5</a></span>Base Library</h1>
215
- <section id="sec-Types" secid="5.1">
216
- <h2><span class="spec-secid" title="link to this section"><a href="#sec-Types">5.1</a></span>Types</h2>
365
+ <section id="sec-Base-Library" secid="6">
366
+ <h1><span class="spec-secid" title="link to this section"><a href="#sec-Base-Library">6</a></span>Base Library</h1>
367
+ <section id="sec-Types" secid="6.1">
368
+ <h2><span class="spec-secid" title="link to this section"><a href="#sec-Types">6.1</a></span>Types</h2>
217
369
  <ul>
218
370
  <li><code>number</code></li>
219
371
  <li><code>string</code></li>
@@ -224,8 +376,8 @@ end
224
376
  <li><code>json</code></li>
225
377
  </ul>
226
378
  </section>
227
- <section id="sec-Built-in-Functions" secid="5.2">
228
- <h2><span class="spec-secid" title="link to this section"><a href="#sec-Built-in-Functions">5.2</a></span>Built-in Functions</h2>
379
+ <section id="sec-Built-in-Functions" secid="6.2">
380
+ <h2><span class="spec-secid" title="link to this section"><a href="#sec-Built-in-Functions">6.2</a></span>Built-in Functions</h2>
229
381
  <table>
230
382
  <thead>
231
383
  <tr>
@@ -281,6 +433,11 @@ end
281
433
  <td align="left">Returns true if the list is empty</td>
282
434
  </tr>
283
435
  <tr>
436
+ <td align="left"><code>log</code></td>
437
+ <td align="left"><code>&lt;any: any&gt;</code></td>
438
+ <td align="left">Logs the value to console and returns it (identity function)</td>
439
+ </tr>
440
+ <tr>
284
441
  <td align="left"><code>map</code></td>
285
442
  <td align="left"><code>&lt;function list: list&gt;</code></td>
286
443
  <td align="left">Applies function to each item</td>
@@ -347,14 +504,14 @@ end
347
504
  </tr>
348
505
  </tbody>
349
506
  </table>
350
- <section id="sec-add" secid="5.2.1">
351
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-add">5.2.1</a></span>add</h3>
507
+ <section id="sec-add" secid="6.2.1">
508
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-add">6.2.1</a></span>add</h3>
352
509
  <p>Add two numbers.</p>
353
510
  <pre><code>add 2 3 | returns 5
354
511
  </code></pre>
355
512
  </section>
356
- <section id="sec-and" secid="5.2.2">
357
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-and">5.2.2</a></span>and</h3>
513
+ <section id="sec-and" secid="6.2.2">
514
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-and">6.2.2</a></span>and</h3>
358
515
  <p>Logical AND operation</p>
359
516
  <pre><code>and false false | returns false
360
517
  and false true | returns false
@@ -362,20 +519,20 @@ and true false | returns false
362
519
  and true true | returns true
363
520
  </code></pre>
364
521
  </section>
365
- <section id="sec-apply" secid="5.2.3">
366
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-apply">5.2.3</a></span>apply</h3>
522
+ <section id="sec-apply" secid="6.2.3">
523
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-apply">6.2.3</a></span>apply</h3>
367
524
  <p>Apply a function to an argument list</p>
368
525
  <pre><code>apply add [1 2] | returns 3
369
526
  </code></pre>
370
527
  </section>
371
- <section id="sec-div" secid="5.2.4">
372
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-div">5.2.4</a></span>div</h3>
528
+ <section id="sec-div" secid="6.2.4">
529
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-div">6.2.4</a></span>div</h3>
373
530
  <p>Divide the first number by the second</p>
374
531
  <pre><code>div 10 2 | returns 5
375
532
  </code></pre>
376
533
  </section>
377
- <section id="sec-equiv" secid="5.2.5">
378
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-equiv">5.2.5</a></span>equiv</h3>
534
+ <section id="sec-equiv" secid="6.2.5">
535
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-equiv">6.2.5</a></span>equiv</h3>
379
536
  <p>Tests if two values are strictly equivalent</p>
380
537
  <pre><code>equiv 1 1 | returns true
381
538
  equiv "a" "a" | returns true
@@ -384,75 +541,82 @@ equiv 1 2 | returns false
384
541
  equiv "a" "b" | returns false
385
542
  </code></pre>
386
543
  </section>
387
- <section id="sec-filter" secid="5.2.6">
388
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-filter">5.2.6</a></span>filter</h3>
544
+ <section id="sec-filter" secid="6.2.6">
545
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-filter">6.2.6</a></span>filter</h3>
389
546
  <p>Filter elements matching predicate</p>
390
547
  <pre><code>filter (&lt;x: mod x 2&gt;) [1 2 3 4] | returns [1 3]
391
548
  </code></pre>
392
549
  </section>
393
- <section id="sec-get" secid="5.2.7">
394
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-get">5.2.7</a></span>get</h3>
550
+ <section id="sec-get" secid="6.2.7">
551
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-get">6.2.7</a></span>get</h3>
395
552
  <p>Retrieve a record field</p>
396
553
  <pre><code>get "b" {a: 1, b: 2} | returns 2
397
554
  </code></pre>
398
555
  </section>
399
- <section id="sec-hd" secid="5.2.8">
400
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-hd">5.2.8</a></span>hd</h3>
556
+ <section id="sec-hd" secid="6.2.8">
557
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-hd">6.2.8</a></span>hd</h3>
401
558
  <p>Return the first item</p>
402
559
  <pre><code>hd [10 20 30] | returns 10
403
560
  </code></pre>
404
561
  </section>
405
- <section id="sec-isEmpty" secid="5.2.9">
406
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-isEmpty">5.2.9</a></span>isEmpty</h3>
562
+ <section id="sec-isEmpty" secid="6.2.9">
563
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-isEmpty">6.2.9</a></span>isEmpty</h3>
407
564
  <p>Return true if list is empty, otherwise return false</p>
408
565
  <pre><code>isEmpty [] | returns true
409
566
  </code></pre>
410
567
  </section>
411
- <section id="sec-map" secid="5.2.10">
412
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-map">5.2.10</a></span>map</h3>
568
+ <section id="sec-log" secid="6.2.10">
569
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-log">6.2.10</a></span>log</h3>
570
+ <p>Log a value to the console and return the value unchanged</p>
571
+ <pre><code>log "Hello" | prints "Hello" to console and returns "Hello"
572
+ log (add 1 2) | prints 3 to console and returns 3
573
+ </code></pre>
574
+ </section>
575
+ <section id="sec-map" secid="6.2.11">
576
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-map">6.2.11</a></span>map</h3>
413
577
  <p>Apply a function to each element</p>
414
578
  <pre><code>map (&lt;x: add x 1&gt;) [1 2 3] | returns [2 3 4]
415
579
  </code></pre>
416
580
  </section>
417
- <section id="sec-max" secid="5.2.11">
418
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-max">5.2.11</a></span>max</h3>
581
+ <section id="sec-max" secid="6.2.12">
582
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-max">6.2.12</a></span>max</h3>
419
583
  <p>Return the larger of two numbers</p>
420
584
  <pre><code>max 5 10 | returns 10
421
585
  </code></pre>
422
586
  </section>
423
- <section id="sec-min" secid="5.2.12">
424
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-min">5.2.12</a></span>min</h3>
587
+ <section id="sec-min" secid="6.2.13">
588
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-min">6.2.13</a></span>min</h3>
425
589
  <p>Return the smaller of two numbers</p>
426
590
  <pre><code>min 5 10 | returns 5
427
591
  </code></pre>
428
592
  </section>
429
- <section id="sec-mod" secid="5.2.13">
430
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-mod">5.2.13</a></span>mod</h3>
593
+ <section id="sec-mod" secid="6.2.14">
594
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-mod">6.2.14</a></span>mod</h3>
431
595
  <p>Compute the remainder</p>
432
596
  <pre><code>mod 10 3 | returns 1
433
597
  </code></pre>
434
598
  </section>
435
- <section id="sec-mul" secid="5.2.14">
436
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-mul">5.2.14</a></span>mul</h3>
599
+ <section id="sec-mul" secid="6.2.15">
600
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-mul">6.2.15</a></span>mul</h3>
437
601
  <p>Multiply two numbers</p>
438
602
  <pre><code>mul 4 3 | returns 12
439
603
  </code></pre>
440
604
  </section>
441
- <section id="sec-not" secid="5.2.15">
442
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-not">5.2.15</a></span>not</h3>
605
+ <section id="sec-not" secid="6.2.16">
606
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-not">6.2.16</a></span>not</h3>
443
607
  <p>Logical NOT that inverts a boolean value</p>
444
608
  <pre><code>not true | returns false
445
609
  not false | returns true
446
610
  </code></pre>
447
611
  </section>
448
- <section id="sec-nth" secid="5.2.16">
449
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-nth">5.2.16</a></span>nth</h3>
612
+ <section id="sec-nth" secid="6.2.17">
613
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-nth">6.2.17</a></span>nth</h3>
450
614
  <p>Get the nth item (0-based)</p>
451
615
  <pre><code>nth 1 [10 20 30] | returns 20
452
616
  </code></pre>
453
617
  </section>
454
- <section id="sec-or" secid="5.2.17">
455
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-or">5.2.17</a></span>or</h3>
618
+ <section id="sec-or" secid="6.2.18">
619
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-or">6.2.18</a></span>or</h3>
456
620
  <p>Logical OR operation</p>
457
621
  <pre><code>or false false | returns false
458
622
  or false true | returns true
@@ -460,40 +624,40 @@ or true false | returns true
460
624
  or true true | returns true
461
625
  </code></pre>
462
626
  </section>
463
- <section id="sec-range" secid="5.2.18">
464
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-range">5.2.18</a></span>range</h3>
627
+ <section id="sec-range" secid="6.2.19">
628
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-range">6.2.19</a></span>range</h3>
465
629
  <p>Produce a range list from start to end (exclusive) with step</p>
466
630
  <pre><code>range 1 10 2 | returns [1 3 5 7 9]
467
631
  </code></pre>
468
632
  </section>
469
- <section id="sec-reduce" secid="5.2.19">
470
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-reduce">5.2.19</a></span>reduce</h3>
633
+ <section id="sec-reduce" secid="6.2.20">
634
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-reduce">6.2.20</a></span>reduce</h3>
471
635
  <p>Reduce a list to a single value, starting with an initial value</p>
472
636
  <pre><code>reduce (&lt;a b: add a b&gt;) 0 [1 2 3 4] | returns 10
473
637
  </code></pre>
474
638
  </section>
475
- <section id="sec-set" secid="5.2.20">
476
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-set">5.2.20</a></span>set</h3>
639
+ <section id="sec-set" secid="6.2.21">
640
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-set">6.2.21</a></span>set</h3>
477
641
  <p>Return a new record with an updated field</p>
478
642
  <pre><code>set "a" 2 {a: 1} | returns {a: 2}
479
643
  </code></pre>
480
644
  </section>
481
- <section id="sec-sub" secid="5.2.21">
482
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-sub">5.2.21</a></span>sub</h3>
645
+ <section id="sec-sub" secid="6.2.22">
646
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-sub">6.2.22</a></span>sub</h3>
483
647
  <p>Subtract the second number from the first</p>
484
648
  <pre><code>sub 5 2 | returns 3
485
649
  </code></pre>
486
650
  </section>
487
- <section id="sec-tl" secid="5.2.22">
488
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-tl">5.2.22</a></span>tl</h3>
651
+ <section id="sec-tl" secid="6.2.23">
652
+ <h3><span class="spec-secid" title="link to this section"><a href="#sec-tl">6.2.23</a></span>tl</h3>
489
653
  <p>Return all but the first item</p>
490
654
  <pre><code>tl [10 20 30] | returns [20 30]
491
655
  </code></pre>
492
656
  </section>
493
657
  </section>
494
658
  </section>
495
- <section id="sec-Program-Examples" secid="6">
496
- <h1><span class="spec-secid" title="link to this section"><a href="#sec-Program-Examples">6</a></span>Program Examples</h1>
659
+ <section id="sec-Program-Examples" secid="7">
660
+ <h1><span class="spec-secid" title="link to this section"><a href="#sec-Program-Examples">7</a></span>Program Examples</h1>
497
661
  <pre><code>let double = &lt;x: mul 2 x&gt;..
498
662
  map (double) [1 2 3]..
499
663
  </code></pre>
@@ -536,61 +700,76 @@ Written in <a href="https://spec-md.com" target="_blank">Spec Markdown</a>.</foo
536
700
  <li id="_sidebar_3.2.1"><a href="#sec-Function-Application"><span class="spec-secid">3.2.1</span>Function Application</a></li>
537
701
  <li id="_sidebar_3.2.2"><a href="#sec-Lists"><span class="spec-secid">3.2.2</span>Lists</a></li>
538
702
  <li id="_sidebar_3.2.3"><a href="#sec-Records"><span class="spec-secid">3.2.3</span>Records</a></li>
539
- <li id="_sidebar_3.2.4"><a href="#sec-Lambdas"><span class="spec-secid">3.2.4</span>Lambdas</a></li>
540
- <li id="_sidebar_3.2.5"><a href="#sec-Let-Bindings"><span class="spec-secid">3.2.5</span>Let Bindings</a></li>
703
+ <li id="_sidebar_3.2.4"><a href="#sec-Tags"><span class="spec-secid">3.2.4</span>Tags</a></li>
704
+ <li id="_sidebar_3.2.5"><a href="#sec-Lambdas"><span class="spec-secid">3.2.5</span>Lambdas</a></li>
705
+ <li id="_sidebar_3.2.6"><a href="#sec-Let-Bindings"><span class="spec-secid">3.2.6</span>Let Bindings</a></li>
706
+ </ol>
707
+ </li>
708
+ <li id="_sidebar_3.3"><a href="#sec-Pattern-Matching"><span class="spec-secid">3.3</span>Pattern Matching</a></li>
541
709
  </ol>
542
710
  </li>
543
- <li id="_sidebar_3.3"><a href="#sec-Pattern-Matching"><span class="spec-secid">3.3</span>Pattern Matching</a>
544
- <input hidden class="toggle" type="checkbox" id="_toggle_3.3" /><label for="_toggle_3.3"></label>
711
+ <li id="_sidebar_4"><a href="#sec-Type-System"><span class="spec-secid">4</span>Type System</a>
712
+ <input hidden class="toggle" type="checkbox" id="_toggle_4" /><label for="_toggle_4"></label>
713
+ <ol>
714
+ <li id="_sidebar_4.1"><a href="#sec-Primitive-Types"><span class="spec-secid">4.1</span>Primitive Types</a></li>
715
+ <li id="_sidebar_4.2"><a href="#sec-Composite-Types"><span class="spec-secid">4.2</span>Composite Types</a></li>
716
+ <li id="_sidebar_4.3"><a href="#sec-Function-Types"><span class="spec-secid">4.3</span>Function Types</a></li>
717
+ <li id="_sidebar_4.4"><a href="#sec-Tag-Sets-and-Tag-Value-Type"><span class="spec-secid">4.4</span>Tag Sets and Tag Value Type</a>
718
+ <input hidden class="toggle" type="checkbox" id="_toggle_4.4" /><label for="_toggle_4.4"></label>
545
719
  <ol>
546
- <li id="_sidebar_3.3.1"><a href="#sec-Tag-Values"><span class="spec-secid">3.3.1</span>Tag Values</a></li>
720
+ <li id="_sidebar_4.4.1"><a href="#sec-Tag-Identity-and-Type"><span class="spec-secid">4.4.1</span>Tag Identity and Type</a></li>
721
+ <li id="_sidebar_4.4.2"><a href="#sec-Tag-Sets-as-Structural-Types"><span class="spec-secid">4.4.2</span>Tag Sets as Structural Types</a></li>
722
+ <li id="_sidebar_4.4.3"><a href="#sec-Default-Type-tag-"><span class="spec-secid">4.4.3</span>Default Type: `tag`</a></li>
723
+ <li id="_sidebar_4.4.4"><a href="#sec-Example"><span class="spec-secid">4.4.4</span>Example</a></li>
547
724
  </ol>
548
725
  </li>
726
+ <li id="_sidebar_4.5"><a href="#sec-Example-Annotated-Definitions"><span class="spec-secid">4.5</span>Example: Annotated Definitions</a></li>
549
727
  </ol>
550
728
  </li>
551
- <li id="_sidebar_4"><a href="#sec-Semantics"><span class="spec-secid">4</span>Semantics</a>
552
- <input hidden class="toggle" type="checkbox" id="_toggle_4" /><label for="_toggle_4"></label>
729
+ <li id="_sidebar_5"><a href="#sec-Semantics"><span class="spec-secid">5</span>Semantics</a>
730
+ <input hidden class="toggle" type="checkbox" id="_toggle_5" /><label for="_toggle_5"></label>
553
731
  <ol>
554
- <li id="_sidebar_4.1"><a href="#sec-Evaluation-Model"><span class="spec-secid">4.1</span>Evaluation Model</a></li>
555
- <li id="_sidebar_4.2"><a href="#sec-Functions"><span class="spec-secid">4.2</span>Functions</a></li>
556
- <li id="_sidebar_4.3"><a href="#sec-Scoping"><span class="spec-secid">4.3</span>Scoping</a></li>
557
- <li id="_sidebar_4.4"><a href="#sec-Errors"><span class="spec-secid">4.4</span>Errors</a></li>
732
+ <li id="_sidebar_5.1"><a href="#sec-Evaluation-Model"><span class="spec-secid">5.1</span>Evaluation Model</a></li>
733
+ <li id="_sidebar_5.2"><a href="#sec-Functions"><span class="spec-secid">5.2</span>Functions</a></li>
734
+ <li id="_sidebar_5.3"><a href="#sec-Scoping"><span class="spec-secid">5.3</span>Scoping</a></li>
735
+ <li id="_sidebar_5.4"><a href="#sec-Errors"><span class="spec-secid">5.4</span>Errors</a></li>
558
736
  </ol>
559
737
  </li>
560
- <li id="_sidebar_5"><a href="#sec-Base-Library"><span class="spec-secid">5</span>Base Library</a>
561
- <input hidden class="toggle" type="checkbox" id="_toggle_5" /><label for="_toggle_5"></label>
738
+ <li id="_sidebar_6"><a href="#sec-Base-Library"><span class="spec-secid">6</span>Base Library</a>
739
+ <input hidden class="toggle" type="checkbox" id="_toggle_6" /><label for="_toggle_6"></label>
562
740
  <ol>
563
- <li id="_sidebar_5.1"><a href="#sec-Types"><span class="spec-secid">5.1</span>Types</a></li>
564
- <li id="_sidebar_5.2"><a href="#sec-Built-in-Functions"><span class="spec-secid">5.2</span>Built-in Functions</a>
565
- <input hidden class="toggle" type="checkbox" id="_toggle_5.2" /><label for="_toggle_5.2"></label>
741
+ <li id="_sidebar_6.1"><a href="#sec-Types"><span class="spec-secid">6.1</span>Types</a></li>
742
+ <li id="_sidebar_6.2"><a href="#sec-Built-in-Functions"><span class="spec-secid">6.2</span>Built-in Functions</a>
743
+ <input hidden class="toggle" type="checkbox" id="_toggle_6.2" /><label for="_toggle_6.2"></label>
566
744
  <ol>
567
- <li id="_sidebar_5.2.1"><a href="#sec-add"><span class="spec-secid">5.2.1</span>add</a></li>
568
- <li id="_sidebar_5.2.2"><a href="#sec-and"><span class="spec-secid">5.2.2</span>and</a></li>
569
- <li id="_sidebar_5.2.3"><a href="#sec-apply"><span class="spec-secid">5.2.3</span>apply</a></li>
570
- <li id="_sidebar_5.2.4"><a href="#sec-div"><span class="spec-secid">5.2.4</span>div</a></li>
571
- <li id="_sidebar_5.2.5"><a href="#sec-equiv"><span class="spec-secid">5.2.5</span>equiv</a></li>
572
- <li id="_sidebar_5.2.6"><a href="#sec-filter"><span class="spec-secid">5.2.6</span>filter</a></li>
573
- <li id="_sidebar_5.2.7"><a href="#sec-get"><span class="spec-secid">5.2.7</span>get</a></li>
574
- <li id="_sidebar_5.2.8"><a href="#sec-hd"><span class="spec-secid">5.2.8</span>hd</a></li>
575
- <li id="_sidebar_5.2.9"><a href="#sec-isEmpty"><span class="spec-secid">5.2.9</span>isEmpty</a></li>
576
- <li id="_sidebar_5.2.10"><a href="#sec-map"><span class="spec-secid">5.2.10</span>map</a></li>
577
- <li id="_sidebar_5.2.11"><a href="#sec-max"><span class="spec-secid">5.2.11</span>max</a></li>
578
- <li id="_sidebar_5.2.12"><a href="#sec-min"><span class="spec-secid">5.2.12</span>min</a></li>
579
- <li id="_sidebar_5.2.13"><a href="#sec-mod"><span class="spec-secid">5.2.13</span>mod</a></li>
580
- <li id="_sidebar_5.2.14"><a href="#sec-mul"><span class="spec-secid">5.2.14</span>mul</a></li>
581
- <li id="_sidebar_5.2.15"><a href="#sec-not"><span class="spec-secid">5.2.15</span>not</a></li>
582
- <li id="_sidebar_5.2.16"><a href="#sec-nth"><span class="spec-secid">5.2.16</span>nth</a></li>
583
- <li id="_sidebar_5.2.17"><a href="#sec-or"><span class="spec-secid">5.2.17</span>or</a></li>
584
- <li id="_sidebar_5.2.18"><a href="#sec-range"><span class="spec-secid">5.2.18</span>range</a></li>
585
- <li id="_sidebar_5.2.19"><a href="#sec-reduce"><span class="spec-secid">5.2.19</span>reduce</a></li>
586
- <li id="_sidebar_5.2.20"><a href="#sec-set"><span class="spec-secid">5.2.20</span>set</a></li>
587
- <li id="_sidebar_5.2.21"><a href="#sec-sub"><span class="spec-secid">5.2.21</span>sub</a></li>
588
- <li id="_sidebar_5.2.22"><a href="#sec-tl"><span class="spec-secid">5.2.22</span>tl</a></li>
745
+ <li id="_sidebar_6.2.1"><a href="#sec-add"><span class="spec-secid">6.2.1</span>add</a></li>
746
+ <li id="_sidebar_6.2.2"><a href="#sec-and"><span class="spec-secid">6.2.2</span>and</a></li>
747
+ <li id="_sidebar_6.2.3"><a href="#sec-apply"><span class="spec-secid">6.2.3</span>apply</a></li>
748
+ <li id="_sidebar_6.2.4"><a href="#sec-div"><span class="spec-secid">6.2.4</span>div</a></li>
749
+ <li id="_sidebar_6.2.5"><a href="#sec-equiv"><span class="spec-secid">6.2.5</span>equiv</a></li>
750
+ <li id="_sidebar_6.2.6"><a href="#sec-filter"><span class="spec-secid">6.2.6</span>filter</a></li>
751
+ <li id="_sidebar_6.2.7"><a href="#sec-get"><span class="spec-secid">6.2.7</span>get</a></li>
752
+ <li id="_sidebar_6.2.8"><a href="#sec-hd"><span class="spec-secid">6.2.8</span>hd</a></li>
753
+ <li id="_sidebar_6.2.9"><a href="#sec-isEmpty"><span class="spec-secid">6.2.9</span>isEmpty</a></li>
754
+ <li id="_sidebar_6.2.10"><a href="#sec-log"><span class="spec-secid">6.2.10</span>log</a></li>
755
+ <li id="_sidebar_6.2.11"><a href="#sec-map"><span class="spec-secid">6.2.11</span>map</a></li>
756
+ <li id="_sidebar_6.2.12"><a href="#sec-max"><span class="spec-secid">6.2.12</span>max</a></li>
757
+ <li id="_sidebar_6.2.13"><a href="#sec-min"><span class="spec-secid">6.2.13</span>min</a></li>
758
+ <li id="_sidebar_6.2.14"><a href="#sec-mod"><span class="spec-secid">6.2.14</span>mod</a></li>
759
+ <li id="_sidebar_6.2.15"><a href="#sec-mul"><span class="spec-secid">6.2.15</span>mul</a></li>
760
+ <li id="_sidebar_6.2.16"><a href="#sec-not"><span class="spec-secid">6.2.16</span>not</a></li>
761
+ <li id="_sidebar_6.2.17"><a href="#sec-nth"><span class="spec-secid">6.2.17</span>nth</a></li>
762
+ <li id="_sidebar_6.2.18"><a href="#sec-or"><span class="spec-secid">6.2.18</span>or</a></li>
763
+ <li id="_sidebar_6.2.19"><a href="#sec-range"><span class="spec-secid">6.2.19</span>range</a></li>
764
+ <li id="_sidebar_6.2.20"><a href="#sec-reduce"><span class="spec-secid">6.2.20</span>reduce</a></li>
765
+ <li id="_sidebar_6.2.21"><a href="#sec-set"><span class="spec-secid">6.2.21</span>set</a></li>
766
+ <li id="_sidebar_6.2.22"><a href="#sec-sub"><span class="spec-secid">6.2.22</span>sub</a></li>
767
+ <li id="_sidebar_6.2.23"><a href="#sec-tl"><span class="spec-secid">6.2.23</span>tl</a></li>
589
768
  </ol>
590
769
  </li>
591
770
  </ol>
592
771
  </li>
593
- <li id="_sidebar_6"><a href="#sec-Program-Examples"><span class="spec-secid">6</span>Program Examples</a></li>
772
+ <li id="_sidebar_7"><a href="#sec-Program-Examples"><span class="spec-secid">7</span>Program Examples</a></li>
594
773
  <li id="_sidebar_index"><a href="#index"><span class="spec-secid">§</span>Index</a></li>
595
774
  </ol>
596
775
  </div>