@graffiticode/basis 1.5.21 → 1.6.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@graffiticode/basis",
3
3
  "type": "module",
4
- "version": "1.5.21",
4
+ "version": "1.6.0",
5
5
  "description": "The basis library for creating Graffiticode languages",
6
6
  "main": "index.js",
7
7
  "scripts": {
package/spec/spec.html CHANGED
@@ -11,6 +11,11 @@
11
11
  <body><article>
12
12
  <header>
13
13
  <h1>Graffiticode Core Language Specification</h1>
14
+ <section id="intro">
15
+ <pre><code>Version: 0.1.0
16
+ Date: 2025-04-30
17
+ </code></pre>
18
+ </section>
14
19
  <nav class="spec-toc">
15
20
  <div class="title">Contents</div>
16
21
  <ol>
@@ -47,27 +52,27 @@
47
52
  <li><a href="#sec-Types"><span class="spec-secid">5.1</span>Types</a></li>
48
53
  <li><a href="#sec-Built-in-Functions"><span class="spec-secid">5.2</span>Built-in Functions</a><ol>
49
54
  <li><a href="#sec-add"><span class="spec-secid">5.2.1</span>add</a></li>
50
- <li><a href="#sec-sub"><span class="spec-secid">5.2.2</span>sub</a></li>
51
- <li><a href="#sec-mul"><span class="spec-secid">5.2.3</span>mul</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>
52
57
  <li><a href="#sec-div"><span class="spec-secid">5.2.4</span>div</a></li>
53
- <li><a href="#sec-mod"><span class="spec-secid">5.2.5</span>mod</a></li>
54
- <li><a href="#sec-min"><span class="spec-secid">5.2.6</span>min</a></li>
55
- <li><a href="#sec-max"><span class="spec-secid">5.2.7</span>max</a></li>
56
- <li><a href="#sec-range"><span class="spec-secid">5.2.8</span>range</a></li>
57
- <li><a href="#sec-map"><span class="spec-secid">5.2.9</span>map</a></li>
58
- <li><a href="#sec-filter"><span class="spec-secid">5.2.10</span>filter</a></li>
59
- <li><a href="#sec-reduce"><span class="spec-secid">5.2.11</span>reduce</a></li>
60
- <li><a href="#sec-hd"><span class="spec-secid">5.2.12</span>hd</a></li>
61
- <li><a href="#sec-tl"><span class="spec-secid">5.2.13</span>tl</a></li>
62
- <li><a href="#sec-nth"><span class="spec-secid">5.2.14</span>nth</a></li>
63
- <li><a href="#sec-apply"><span class="spec-secid">5.2.15</span>apply</a></li>
64
- <li><a href="#sec-isEmpty"><span class="spec-secid">5.2.16</span>isEmpty</a></li>
65
- <li><a href="#sec-get"><span class="spec-secid">5.2.17</span>get</a></li>
66
- <li><a href="#sec-set"><span class="spec-secid">5.2.18</span>set</a></li>
67
- <li><a href="#sec-not"><span class="spec-secid">5.2.19</span>not</a></li>
68
- <li><a href="#sec-equiv"><span class="spec-secid">5.2.20</span>equiv</a></li>
69
- <li><a href="#sec-or"><span class="spec-secid">5.2.21</span>or</a></li>
70
- <li><a href="#sec-and"><span class="spec-secid">5.2.22</span>and</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>
71
76
  </ol>
72
77
  </li>
73
78
  </ol>
@@ -236,14 +241,14 @@ end
236
241
  <td align="left">Adds two numbers</td>
237
242
  </tr>
238
243
  <tr>
239
- <td align="left"><code>sub</code></td>
240
- <td align="left"><code>&lt;number number: number&gt;</code></td>
241
- <td align="left">Subtracts numbers</td>
244
+ <td align="left"><code>and</code></td>
245
+ <td align="left"><code>&lt;bool bool: bool&gt;</code></td>
246
+ <td align="left">Logical AND operation</td>
242
247
  </tr>
243
248
  <tr>
244
- <td align="left"><code>mul</code></td>
245
- <td align="left"><code>&lt;number number: number&gt;</code></td>
246
- <td align="left">Multiplies numbers</td>
249
+ <td align="left"><code>apply</code></td>
250
+ <td align="left"><code>&lt;function list: any&gt;</code></td>
251
+ <td align="left">Applies a function to a list of arguments</td>
247
252
  </tr>
248
253
  <tr>
249
254
  <td align="left"><code>div</code></td>
@@ -251,24 +256,29 @@ end
251
256
  <td align="left">Divides numbers</td>
252
257
  </tr>
253
258
  <tr>
254
- <td align="left"><code>mod</code></td>
255
- <td align="left"><code>&lt;number number: number&gt;</code></td>
256
- <td align="left">Remainder of division</td>
259
+ <td align="left"><code>equiv</code></td>
260
+ <td align="left"><code>&lt;any any: bool&gt;</code></td>
261
+ <td align="left">Tests if two values are strictly equivalent</td>
257
262
  </tr>
258
263
  <tr>
259
- <td align="left"><code>min</code></td>
260
- <td align="left"><code>&lt;number number: number&gt;</code></td>
261
- <td align="left">Returns the smaller of two numbers</td>
264
+ <td align="left"><code>filter</code></td>
265
+ <td align="left"><code>&lt;function list: list&gt;</code></td>
266
+ <td align="left">Keeps items matching predicate</td>
262
267
  </tr>
263
268
  <tr>
264
- <td align="left"><code>max</code></td>
265
- <td align="left"><code>&lt;number number: number&gt;</code></td>
266
- <td align="left">Returns the larger of two numbers</td>
269
+ <td align="left"><code>get</code></td>
270
+ <td align="left"><code>&lt;string record: any&gt;</code></td>
271
+ <td align="left">Retrieves a value from a record by key</td>
267
272
  </tr>
268
273
  <tr>
269
- <td align="left"><code>range</code></td>
270
- <td align="left"><code>&lt;number number number: list&gt;</code></td>
271
- <td align="left">Generates a range list</td>
274
+ <td align="left"><code>hd</code></td>
275
+ <td align="left"><code>&lt;list: any&gt;</code></td>
276
+ <td align="left">First item of list</td>
277
+ </tr>
278
+ <tr>
279
+ <td align="left"><code>isEmpty</code></td>
280
+ <td align="left"><code>&lt;list: bool&gt;</code></td>
281
+ <td align="left">Returns true if the list is empty</td>
272
282
  </tr>
273
283
  <tr>
274
284
  <td align="left"><code>map</code></td>
@@ -276,24 +286,29 @@ end
276
286
  <td align="left">Applies function to each item</td>
277
287
  </tr>
278
288
  <tr>
279
- <td align="left"><code>filter</code></td>
280
- <td align="left"><code>&lt;function list: list&gt;</code></td>
281
- <td align="left">Keeps items matching predicate</td>
289
+ <td align="left"><code>max</code></td>
290
+ <td align="left"><code>&lt;number number: number&gt;</code></td>
291
+ <td align="left">Returns the larger of two numbers</td>
282
292
  </tr>
283
293
  <tr>
284
- <td align="left"><code>reduce</code></td>
285
- <td align="left"><code>&lt;function any list: any&gt;</code></td>
286
- <td align="left">Combines list using a reducer with initial value</td>
294
+ <td align="left"><code>min</code></td>
295
+ <td align="left"><code>&lt;number number: number&gt;</code></td>
296
+ <td align="left">Returns the smaller of two numbers</td>
287
297
  </tr>
288
298
  <tr>
289
- <td align="left"><code>hd</code></td>
290
- <td align="left"><code>&lt;list: any&gt;</code></td>
291
- <td align="left">First item of list</td>
299
+ <td align="left"><code>mod</code></td>
300
+ <td align="left"><code>&lt;number number: number&gt;</code></td>
301
+ <td align="left">Remainder of division</td>
292
302
  </tr>
293
303
  <tr>
294
- <td align="left"><code>tl</code></td>
295
- <td align="left"><code>&lt;list: list&gt;</code></td>
296
- <td align="left">All items except first</td>
304
+ <td align="left"><code>mul</code></td>
305
+ <td align="left"><code>&lt;number number: number&gt;</code></td>
306
+ <td align="left">Multiplies numbers</td>
307
+ </tr>
308
+ <tr>
309
+ <td align="left"><code>not</code></td>
310
+ <td align="left"><code>&lt;bool: bool&gt;</code></td>
311
+ <td align="left">Logical NOT operation, inverts a boolean value</td>
297
312
  </tr>
298
313
  <tr>
299
314
  <td align="left"><code>nth</code></td>
@@ -301,19 +316,19 @@ end
301
316
  <td align="left">Nth element of list</td>
302
317
  </tr>
303
318
  <tr>
304
- <td align="left"><code>apply</code></td>
305
- <td align="left"><code>&lt;function list: any&gt;</code></td>
306
- <td align="left">Applies a function to a list of arguments</td>
319
+ <td align="left"><code>or</code></td>
320
+ <td align="left"><code>&lt;bool bool: bool&gt;</code></td>
321
+ <td align="left">Logical OR operation</td>
307
322
  </tr>
308
323
  <tr>
309
- <td align="left"><code>isEmpty</code></td>
310
- <td align="left"><code>&lt;list: bool&gt;</code></td>
311
- <td align="left">Returns true if the list is empty</td>
324
+ <td align="left"><code>range</code></td>
325
+ <td align="left"><code>&lt;number number number: list&gt;</code></td>
326
+ <td align="left">Generates a range list</td>
312
327
  </tr>
313
328
  <tr>
314
- <td align="left"><code>get</code></td>
315
- <td align="left"><code>&lt;string record: any&gt;</code></td>
316
- <td align="left">Retrieves a value from a record by key</td>
329
+ <td align="left"><code>reduce</code></td>
330
+ <td align="left"><code>&lt;function any list: any&gt;</code></td>
331
+ <td align="left">Combines list using a reducer with initial value</td>
317
332
  </tr>
318
333
  <tr>
319
334
  <td align="left"><code>set</code></td>
@@ -321,24 +336,14 @@ end
321
336
  <td align="left">Returns a new record with a key set to a value</td>
322
337
  </tr>
323
338
  <tr>
324
- <td align="left"><code>not</code></td>
325
- <td align="left"><code>&lt;bool: bool&gt;</code></td>
326
- <td align="left">Logical NOT operation, inverts a boolean value</td>
327
- </tr>
328
- <tr>
329
- <td align="left"><code>equiv</code></td>
330
- <td align="left"><code>&lt;any any: bool&gt;</code></td>
331
- <td align="left">Tests if two values are strictly equivalent</td>
332
- </tr>
333
- <tr>
334
- <td align="left"><code>or</code></td>
335
- <td align="left"><code>&lt;bool bool: bool&gt;</code></td>
336
- <td align="left">Logical OR operation</td>
339
+ <td align="left"><code>sub</code></td>
340
+ <td align="left"><code>&lt;number number: number&gt;</code></td>
341
+ <td align="left">Subtracts numbers</td>
337
342
  </tr>
338
343
  <tr>
339
- <td align="left"><code>and</code></td>
340
- <td align="left"><code>&lt;bool bool: bool&gt;</code></td>
341
- <td align="left">Logical AND operation</td>
344
+ <td align="left"><code>tl</code></td>
345
+ <td align="left"><code>&lt;list: list&gt;</code></td>
346
+ <td align="left">All items except first</td>
342
347
  </tr>
343
348
  </tbody>
344
349
  </table>
@@ -348,16 +353,19 @@ end
348
353
  <pre><code>add 2 3 | returns 5
349
354
  </code></pre>
350
355
  </section>
351
- <section id="sec-sub" secid="5.2.2">
352
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-sub">5.2.2</a></span>sub</h3>
353
- <p>Subtract the second number from the first</p>
354
- <pre><code>sub 5 2 | returns 3
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>
358
+ <p>Logical AND operation</p>
359
+ <pre><code>and false false | returns false
360
+ and false true | returns false
361
+ and true false | returns false
362
+ and true true | returns true
355
363
  </code></pre>
356
364
  </section>
357
- <section id="sec-mul" secid="5.2.3">
358
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-mul">5.2.3</a></span>mul</h3>
359
- <p>Multiply two numbers</p>
360
- <pre><code>mul 4 3 | returns 12
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>
367
+ <p>Apply a function to an argument list</p>
368
+ <pre><code>apply add [1 2] | returns 3
361
369
  </code></pre>
362
370
  </section>
363
371
  <section id="sec-div" secid="5.2.4">
@@ -366,109 +374,85 @@ end
366
374
  <pre><code>div 10 2 | returns 5
367
375
  </code></pre>
368
376
  </section>
369
- <section id="sec-mod" secid="5.2.5">
370
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-mod">5.2.5</a></span>mod</h3>
371
- <p>Compute the remainder</p>
372
- <pre><code>mod 10 3 | returns 1
373
- </code></pre>
374
- </section>
375
- <section id="sec-min" secid="5.2.6">
376
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-min">5.2.6</a></span>min</h3>
377
- <p>Return the smaller of two numbers</p>
378
- <pre><code>min 5 10 | returns 5
379
- </code></pre>
380
- </section>
381
- <section id="sec-max" secid="5.2.7">
382
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-max">5.2.7</a></span>max</h3>
383
- <p>Return the larger of two numbers</p>
384
- <pre><code>max 5 10 | returns 10
385
- </code></pre>
386
- </section>
387
- <section id="sec-range" secid="5.2.8">
388
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-range">5.2.8</a></span>range</h3>
389
- <p>Produce a range list from start to end (exclusive) with step</p>
390
- <pre><code>range 1 10 2 | returns [1 3 5 7 9]
391
- </code></pre>
392
- </section>
393
- <section id="sec-map" secid="5.2.9">
394
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-map">5.2.9</a></span>map</h3>
395
- <p>Apply a function to each element</p>
396
- <pre><code>map (&lt;x: add x 1&gt;) [1 2 3] | returns [2 3 4]
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>
379
+ <p>Tests if two values are strictly equivalent</p>
380
+ <pre><code>equiv 1 1 | returns true
381
+ equiv "a" "a" | returns true
382
+ equiv true true | returns true
383
+ equiv 1 2 | returns false
384
+ equiv "a" "b" | returns false
397
385
  </code></pre>
398
386
  </section>
399
- <section id="sec-filter" secid="5.2.10">
400
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-filter">5.2.10</a></span>filter</h3>
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>
401
389
  <p>Filter elements matching predicate</p>
402
390
  <pre><code>filter (&lt;x: mod x 2&gt;) [1 2 3 4] | returns [1 3]
403
391
  </code></pre>
404
392
  </section>
405
- <section id="sec-reduce" secid="5.2.11">
406
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-reduce">5.2.11</a></span>reduce</h3>
407
- <p>Reduce a list to a single value, starting with an initial value</p>
408
- <pre><code>reduce (&lt;a b: add a b&gt;) 0 [1 2 3 4] | returns 10
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>
395
+ <p>Retrieve a record field</p>
396
+ <pre><code>get "b" {a: 1, b: 2} | returns 2
409
397
  </code></pre>
410
398
  </section>
411
- <section id="sec-hd" secid="5.2.12">
412
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-hd">5.2.12</a></span>hd</h3>
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>
413
401
  <p>Return the first item</p>
414
402
  <pre><code>hd [10 20 30] | returns 10
415
403
  </code></pre>
416
404
  </section>
417
- <section id="sec-tl" secid="5.2.13">
418
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-tl">5.2.13</a></span>tl</h3>
419
- <p>Return all but the first item</p>
420
- <pre><code>tl [10 20 30] | returns [20 30]
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>
407
+ <p>Return true if list is empty, otherwise return false</p>
408
+ <pre><code>isEmpty [] | returns true
421
409
  </code></pre>
422
410
  </section>
423
- <section id="sec-nth" secid="5.2.14">
424
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-nth">5.2.14</a></span>nth</h3>
425
- <p>Get the nth item (0-based)</p>
426
- <pre><code>nth 1 [10 20 30] | returns 20
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>
413
+ <p>Apply a function to each element</p>
414
+ <pre><code>map (&lt;x: add x 1&gt;) [1 2 3] | returns [2 3 4]
427
415
  </code></pre>
428
416
  </section>
429
- <section id="sec-apply" secid="5.2.15">
430
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-apply">5.2.15</a></span>apply</h3>
431
- <p>Apply a function to an argument list</p>
432
- <pre><code>apply add [1 2] | returns 3
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>
419
+ <p>Return the larger of two numbers</p>
420
+ <pre><code>max 5 10 | returns 10
433
421
  </code></pre>
434
422
  </section>
435
- <section id="sec-isEmpty" secid="5.2.16">
436
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-isEmpty">5.2.16</a></span>isEmpty</h3>
437
- <p>Return true if list is empty, otherwise return false</p>
438
- <pre><code>isEmpty [] | returns true
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>
425
+ <p>Return the smaller of two numbers</p>
426
+ <pre><code>min 5 10 | returns 5
439
427
  </code></pre>
440
428
  </section>
441
- <section id="sec-get" secid="5.2.17">
442
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-get">5.2.17</a></span>get</h3>
443
- <p>Retrieve a record field</p>
444
- <pre><code>get "b" {a: 1, b: 2} | returns 2
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>
431
+ <p>Compute the remainder</p>
432
+ <pre><code>mod 10 3 | returns 1
445
433
  </code></pre>
446
434
  </section>
447
- <section id="sec-set" secid="5.2.18">
448
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-set">5.2.18</a></span>set</h3>
449
- <p>Return a new record with an updated field</p>
450
- <pre><code>set "a" 2 {a: 1} | returns {a: 2}
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>
437
+ <p>Multiply two numbers</p>
438
+ <pre><code>mul 4 3 | returns 12
451
439
  </code></pre>
452
440
  </section>
453
- <section id="sec-not" secid="5.2.19">
454
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-not">5.2.19</a></span>not</h3>
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>
455
443
  <p>Logical NOT that inverts a boolean value</p>
456
444
  <pre><code>not true | returns false
457
445
  not false | returns true
458
446
  </code></pre>
459
447
  </section>
460
- <section id="sec-equiv" secid="5.2.20">
461
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-equiv">5.2.20</a></span>equiv</h3>
462
- <p>Tests if two values are strictly equivalent</p>
463
- <pre><code>equiv 1 1 | returns true
464
- equiv "a" "a" | returns true
465
- equiv true true | returns true
466
- equiv 1 2 | returns false
467
- equiv "a" "b" | returns false
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>
450
+ <p>Get the nth item (0-based)</p>
451
+ <pre><code>nth 1 [10 20 30] | returns 20
468
452
  </code></pre>
469
453
  </section>
470
- <section id="sec-or" secid="5.2.21">
471
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-or">5.2.21</a></span>or</h3>
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>
472
456
  <p>Logical OR operation</p>
473
457
  <pre><code>or false false | returns false
474
458
  or false true | returns true
@@ -476,13 +460,34 @@ or true false | returns true
476
460
  or true true | returns true
477
461
  </code></pre>
478
462
  </section>
479
- <section id="sec-and" secid="5.2.22">
480
- <h3><span class="spec-secid" title="link to this section"><a href="#sec-and">5.2.22</a></span>and</h3>
481
- <p>Logical AND operation</p>
482
- <pre><code>and false false | returns false
483
- and false true | returns false
484
- and true false | returns false
485
- and true true | returns true
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>
465
+ <p>Produce a range list from start to end (exclusive) with step</p>
466
+ <pre><code>range 1 10 2 | returns [1 3 5 7 9]
467
+ </code></pre>
468
+ </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>
471
+ <p>Reduce a list to a single value, starting with an initial value</p>
472
+ <pre><code>reduce (&lt;a b: add a b&gt;) 0 [1 2 3 4] | returns 10
473
+ </code></pre>
474
+ </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>
477
+ <p>Return a new record with an updated field</p>
478
+ <pre><code>set "a" 2 {a: 1} | returns {a: 2}
479
+ </code></pre>
480
+ </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>
483
+ <p>Subtract the second number from the first</p>
484
+ <pre><code>sub 5 2 | returns 3
485
+ </code></pre>
486
+ </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>
489
+ <p>Return all but the first item</p>
490
+ <pre><code>tl [10 20 30] | returns [20 30]
486
491
  </code></pre>
487
492
  </section>
488
493
  </section>
@@ -560,27 +565,27 @@ Written in <a href="https://spec-md.com" target="_blank">Spec Markdown</a>.</foo
560
565
  <input hidden class="toggle" type="checkbox" id="_toggle_5.2" /><label for="_toggle_5.2"></label>
561
566
  <ol>
562
567
  <li id="_sidebar_5.2.1"><a href="#sec-add"><span class="spec-secid">5.2.1</span>add</a></li>
563
- <li id="_sidebar_5.2.2"><a href="#sec-sub"><span class="spec-secid">5.2.2</span>sub</a></li>
564
- <li id="_sidebar_5.2.3"><a href="#sec-mul"><span class="spec-secid">5.2.3</span>mul</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>
565
570
  <li id="_sidebar_5.2.4"><a href="#sec-div"><span class="spec-secid">5.2.4</span>div</a></li>
566
- <li id="_sidebar_5.2.5"><a href="#sec-mod"><span class="spec-secid">5.2.5</span>mod</a></li>
567
- <li id="_sidebar_5.2.6"><a href="#sec-min"><span class="spec-secid">5.2.6</span>min</a></li>
568
- <li id="_sidebar_5.2.7"><a href="#sec-max"><span class="spec-secid">5.2.7</span>max</a></li>
569
- <li id="_sidebar_5.2.8"><a href="#sec-range"><span class="spec-secid">5.2.8</span>range</a></li>
570
- <li id="_sidebar_5.2.9"><a href="#sec-map"><span class="spec-secid">5.2.9</span>map</a></li>
571
- <li id="_sidebar_5.2.10"><a href="#sec-filter"><span class="spec-secid">5.2.10</span>filter</a></li>
572
- <li id="_sidebar_5.2.11"><a href="#sec-reduce"><span class="spec-secid">5.2.11</span>reduce</a></li>
573
- <li id="_sidebar_5.2.12"><a href="#sec-hd"><span class="spec-secid">5.2.12</span>hd</a></li>
574
- <li id="_sidebar_5.2.13"><a href="#sec-tl"><span class="spec-secid">5.2.13</span>tl</a></li>
575
- <li id="_sidebar_5.2.14"><a href="#sec-nth"><span class="spec-secid">5.2.14</span>nth</a></li>
576
- <li id="_sidebar_5.2.15"><a href="#sec-apply"><span class="spec-secid">5.2.15</span>apply</a></li>
577
- <li id="_sidebar_5.2.16"><a href="#sec-isEmpty"><span class="spec-secid">5.2.16</span>isEmpty</a></li>
578
- <li id="_sidebar_5.2.17"><a href="#sec-get"><span class="spec-secid">5.2.17</span>get</a></li>
579
- <li id="_sidebar_5.2.18"><a href="#sec-set"><span class="spec-secid">5.2.18</span>set</a></li>
580
- <li id="_sidebar_5.2.19"><a href="#sec-not"><span class="spec-secid">5.2.19</span>not</a></li>
581
- <li id="_sidebar_5.2.20"><a href="#sec-equiv"><span class="spec-secid">5.2.20</span>equiv</a></li>
582
- <li id="_sidebar_5.2.21"><a href="#sec-or"><span class="spec-secid">5.2.21</span>or</a></li>
583
- <li id="_sidebar_5.2.22"><a href="#sec-and"><span class="spec-secid">5.2.22</span>and</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>
584
589
  </ol>
585
590
  </li>
586
591
  </ol>
package/spec/spec.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Graffiticode Core Language Specification
2
2
 
3
+ ```
4
+ Version: 0.1.0
5
+ Date: 2025-04-30
6
+ ```
7
+
3
8
  # Introduction
4
9
 
5
10
  This document defines the **Graffiticode Core Language Specification**, covering syntax, semantics, and the base library. It excludes dialect-specific constructs, runtime behavior, and extended libraries.
@@ -160,27 +165,27 @@ This approach draws inspiration from **Model-View-Update** (MVU) architectures,
160
165
  | Function | Signature | Description |
161
166
  | :------- | :-------- | :---------- |
162
167
  | `add` | `<number number: number>` | Adds two numbers |
163
- | `sub` | `<number number: number>` | Subtracts numbers |
164
- | `mul` | `<number number: number>` | Multiplies numbers |
168
+ | `and` | `<bool bool: bool>` | Logical AND operation |
169
+ | `apply` | `<function list: any>` | Applies a function to a list of arguments |
165
170
  | `div` | `<number number: number>` | Divides numbers |
166
- | `mod` | `<number number: number>` | Remainder of division |
167
- | `min` | `<number number: number>` | Returns the smaller of two numbers |
168
- | `max` | `<number number: number>` | Returns the larger of two numbers |
169
- | `range` | `<number number number: list>` | Generates a range list |
170
- | `map` | `<function list: list>` | Applies function to each item |
171
+ | `equiv` | `<any any: bool>` | Tests if two values are strictly equivalent |
171
172
  | `filter` | `<function list: list>` | Keeps items matching predicate |
172
- | `reduce` | `<function any list: any>` | Combines list using a reducer with initial value |
173
+ | `get` | `<string record: any>` | Retrieves a value from a record by key |
173
174
  | `hd` | `<list: any>` | First item of list |
174
- | `tl` | `<list: list>` | All items except first |
175
- | `nth` | `<number list: any>` | Nth element of list |
176
- | `apply` | `<function list: any>` | Applies a function to a list of arguments |
177
175
  | `isEmpty` | `<list: bool>` | Returns true if the list is empty |
178
- | `get` | `<string record: any>` | Retrieves a value from a record by key |
179
- | `set` | `<string any record: record>` | Returns a new record with a key set to a value |
176
+ | `map` | `<function list: list>` | Applies function to each item |
177
+ | `max` | `<number number: number>` | Returns the larger of two numbers |
178
+ | `min` | `<number number: number>` | Returns the smaller of two numbers |
179
+ | `mod` | `<number number: number>` | Remainder of division |
180
+ | `mul` | `<number number: number>` | Multiplies numbers |
180
181
  | `not` | `<bool: bool>` | Logical NOT operation, inverts a boolean value |
181
- | `equiv` | `<any any: bool>` | Tests if two values are strictly equivalent |
182
+ | `nth` | `<number list: any>` | Nth element of list |
182
183
  | `or` | `<bool bool: bool>` | Logical OR operation |
183
- | `and` | `<bool bool: bool>` | Logical AND operation |
184
+ | `range` | `<number number number: list>` | Generates a range list |
185
+ | `reduce` | `<function any list: any>` | Combines list using a reducer with initial value |
186
+ | `set` | `<string any record: record>` | Returns a new record with a key set to a value |
187
+ | `sub` | `<number number: number>` | Subtracts numbers |
188
+ | `tl` | `<list: list>` | All items except first |
184
189
 
185
190
  ### add
186
191
 
@@ -190,20 +195,23 @@ Add two numbers.
190
195
  add 2 3 | returns 5
191
196
  ```
192
197
 
193
- ### sub
198
+ ### and
194
199
 
195
- Subtract the second number from the first
200
+ Logical AND operation
196
201
 
197
202
  ```
198
- sub 5 2 | returns 3
203
+ and false false | returns false
204
+ and false true | returns false
205
+ and true false | returns false
206
+ and true true | returns true
199
207
  ```
200
208
 
201
- ### mul
209
+ ### apply
202
210
 
203
- Multiply two numbers
211
+ Apply a function to an argument list
204
212
 
205
213
  ```
206
- mul 4 3 | returns 12
214
+ apply add [1 2] | returns 3
207
215
  ```
208
216
 
209
217
  ### div
@@ -214,159 +222,156 @@ Divide the first number by the second
214
222
  div 10 2 | returns 5
215
223
  ```
216
224
 
217
- ### mod
225
+ ### equiv
218
226
 
219
- Compute the remainder
227
+ Tests if two values are strictly equivalent
220
228
 
221
229
  ```
222
- mod 10 3 | returns 1
230
+ equiv 1 1 | returns true
231
+ equiv "a" "a" | returns true
232
+ equiv true true | returns true
233
+ equiv 1 2 | returns false
234
+ equiv "a" "b" | returns false
223
235
  ```
224
236
 
225
- ### min
237
+ ### filter
226
238
 
227
- Return the smaller of two numbers
239
+ Filter elements matching predicate
228
240
 
229
241
  ```
230
- min 5 10 | returns 5
242
+ filter (<x: mod x 2>) [1 2 3 4] | returns [1 3]
231
243
  ```
232
244
 
233
- ### max
245
+ ### get
234
246
 
235
- Return the larger of two numbers
247
+ Retrieve a record field
236
248
 
237
249
  ```
238
- max 5 10 | returns 10
250
+ get "b" {a: 1, b: 2} | returns 2
239
251
  ```
240
252
 
241
- ### range
253
+ ### hd
242
254
 
243
- Produce a range list from start to end (exclusive) with step
255
+ Return the first item
244
256
 
245
257
  ```
246
- range 1 10 2 | returns [1 3 5 7 9]
258
+ hd [10 20 30] | returns 10
247
259
  ```
248
260
 
249
- ### map
261
+ ### isEmpty
250
262
 
251
- Apply a function to each element
263
+ Return true if list is empty, otherwise return false
252
264
 
253
265
  ```
254
- map (<x: add x 1>) [1 2 3] | returns [2 3 4]
266
+ isEmpty [] | returns true
255
267
  ```
256
268
 
257
- ### filter
269
+ ### map
258
270
 
259
- Filter elements matching predicate
271
+ Apply a function to each element
260
272
 
261
273
  ```
262
- filter (<x: mod x 2>) [1 2 3 4] | returns [1 3]
274
+ map (<x: add x 1>) [1 2 3] | returns [2 3 4]
263
275
  ```
264
276
 
265
- ### reduce
277
+ ### max
266
278
 
267
- Reduce a list to a single value, starting with an initial value
279
+ Return the larger of two numbers
268
280
 
269
281
  ```
270
- reduce (<a b: add a b>) 0 [1 2 3 4] | returns 10
282
+ max 5 10 | returns 10
271
283
  ```
272
284
 
273
- ### hd
285
+ ### min
274
286
 
275
- Return the first item
287
+ Return the smaller of two numbers
276
288
 
277
289
  ```
278
- hd [10 20 30] | returns 10
290
+ min 5 10 | returns 5
279
291
  ```
280
292
 
281
- ### tl
293
+ ### mod
282
294
 
283
- Return all but the first item
295
+ Compute the remainder
284
296
 
285
297
  ```
286
- tl [10 20 30] | returns [20 30]
298
+ mod 10 3 | returns 1
287
299
  ```
288
300
 
289
- ### nth
301
+ ### mul
290
302
 
291
- Get the nth item (0-based)
303
+ Multiply two numbers
292
304
 
293
305
  ```
294
- nth 1 [10 20 30] | returns 20
306
+ mul 4 3 | returns 12
295
307
  ```
296
308
 
297
- ### apply
309
+ ### not
298
310
 
299
- Apply a function to an argument list
311
+ Logical NOT that inverts a boolean value
300
312
 
301
313
  ```
302
- apply add [1 2] | returns 3
314
+ not true | returns false
315
+ not false | returns true
303
316
  ```
304
317
 
305
- ### isEmpty
318
+ ### nth
306
319
 
307
- Return true if list is empty, otherwise return false
320
+ Get the nth item (0-based)
308
321
 
309
322
  ```
310
- isEmpty [] | returns true
323
+ nth 1 [10 20 30] | returns 20
311
324
  ```
312
325
 
313
- ### get
326
+ ### or
314
327
 
315
- Retrieve a record field
328
+ Logical OR operation
316
329
 
317
330
  ```
318
- get "b" {a: 1, b: 2} | returns 2
331
+ or false false | returns false
332
+ or false true | returns true
333
+ or true false | returns true
334
+ or true true | returns true
319
335
  ```
320
336
 
321
- ### set
337
+ ### range
322
338
 
323
- Return a new record with an updated field
339
+ Produce a range list from start to end (exclusive) with step
324
340
 
325
341
  ```
326
- set "a" 2 {a: 1} | returns {a: 2}
342
+ range 1 10 2 | returns [1 3 5 7 9]
327
343
  ```
328
344
 
329
- ### not
345
+ ### reduce
330
346
 
331
- Logical NOT that inverts a boolean value
347
+ Reduce a list to a single value, starting with an initial value
332
348
 
333
349
  ```
334
- not true | returns false
335
- not false | returns true
350
+ reduce (<a b: add a b>) 0 [1 2 3 4] | returns 10
336
351
  ```
337
352
 
338
- ### equiv
353
+ ### set
339
354
 
340
- Tests if two values are strictly equivalent
355
+ Return a new record with an updated field
341
356
 
342
357
  ```
343
- equiv 1 1 | returns true
344
- equiv "a" "a" | returns true
345
- equiv true true | returns true
346
- equiv 1 2 | returns false
347
- equiv "a" "b" | returns false
358
+ set "a" 2 {a: 1} | returns {a: 2}
348
359
  ```
349
360
 
350
- ### or
361
+ ### sub
351
362
 
352
- Logical OR operation
363
+ Subtract the second number from the first
353
364
 
354
365
  ```
355
- or false false | returns false
356
- or false true | returns true
357
- or true false | returns true
358
- or true true | returns true
366
+ sub 5 2 | returns 3
359
367
  ```
360
368
 
361
- ### and
369
+ ### tl
362
370
 
363
- Logical AND operation
371
+ Return all but the first item
364
372
 
365
373
  ```
366
- and false false | returns false
367
- and false true | returns false
368
- and true false | returns false
369
- and true true | returns true
374
+ tl [10 20 30] | returns [20 30]
370
375
  ```
371
376
 
372
377
  # Program Examples
package/src/compiler.js CHANGED
@@ -38,6 +38,7 @@ class Visitor {
38
38
  // "Visitor/visit()",
39
39
  // "nodePool=" + JSON.stringify(this.nodePool, null, 2),
40
40
  // "node.tag=" + node.tag,
41
+ // "options=" + JSON.stringify(options, null, 2),
41
42
  // );
42
43
  const fn = (this[node.tag] || this["CATCH_ALL"])?.bind(this);
43
44
  assert(node && node.tag && node.elts, "2000: Visitor.visit() tag=" + node.tag + " elts= " + JSON.stringify(node.elts));
package/src/lexicon.js CHANGED
@@ -1,233 +1,274 @@
1
- export const lexicon = {
2
- "print" : {
1
+ export default {
2
+ "print": {
3
3
  "tk": 1,
4
4
  "name": "PRINT",
5
5
  "cls": "function",
6
6
  "length": 1,
7
- "arity": 1
7
+ "arity": 1,
8
+ "description": "Outputs a value to the form."
8
9
  },
9
- "get" : {
10
+ "get": {
10
11
  "tk": 1,
11
12
  "name": "GET",
12
13
  "cls": "function",
13
14
  "length": 2,
14
15
  "arity": 2,
16
+ "description": "Retrieves a value from a record or list by key or index."
15
17
  },
16
- "set" : {
18
+ "set": {
17
19
  "tk": 1,
18
20
  "name": "SET",
19
21
  "cls": "function",
20
22
  "length": 3,
21
23
  "arity": 3,
24
+ "description": "Returns a new record or list with the specified key or index updated."
22
25
  },
23
- "nth" : {
26
+ "nth": {
24
27
  "tk": 1,
25
28
  "name": "NTH",
26
29
  "cls": "function",
27
30
  "length": 2,
28
- "arity": 2
31
+ "arity": 2,
32
+ "description": "Returns the nth element of a list by index."
29
33
  },
30
- "sub" : {
34
+ "sub": {
31
35
  "tk": 1,
32
36
  "name": "SUB",
33
37
  "cls": "function",
34
38
  "length": 2,
35
- "arity": 2
39
+ "arity": 2,
40
+ "description": "Subtracts the second number from the first."
36
41
  },
37
- "filter" : {
42
+ "filter": {
38
43
  "tk": 1,
39
44
  "name": "FILTER",
40
45
  "cls": "function",
41
46
  "length": 2,
42
- "arity": 2
47
+ "arity": 2,
48
+ "description": "Returns a list of elements that match a predicate."
43
49
  },
44
- "reduce" : {
50
+ "reduce": {
45
51
  "tk": 1,
46
52
  "name": "REDUCE",
47
53
  "cls": "function",
48
54
  "length": 3,
49
- "arity": 3
55
+ "arity": 3,
56
+ "description": "Reduces a list to a single value using a binary function and initial value."
50
57
  },
51
- "map" : {
58
+ "map": {
52
59
  "tk": 1,
53
60
  "name": "MAP",
54
61
  "cls": "function",
55
62
  "length": 2,
56
- "arity": 2
63
+ "arity": 2,
64
+ "description": "Applies a function to each element in a list and returns a new list."
57
65
  },
58
- "lt" : {
66
+ "lt": {
59
67
  "tk": 1,
60
68
  "name": "LT",
61
69
  "cls": "function",
62
70
  "length": 2,
63
- "arity": 2
71
+ "arity": 2,
72
+ "description": "Returns true if the first value is less than the second."
64
73
  },
65
- "le" : {
74
+ "le": {
66
75
  "tk": 1,
67
76
  "name": "LE",
68
77
  "cls": "function",
69
78
  "length": 2,
70
- "arity": 2
79
+ "arity": 2,
80
+ "description": "Returns true if the first value is less than or equal to the second."
71
81
  },
72
- "gt" : {
82
+ "gt": {
73
83
  "tk": 1,
74
84
  "name": "GT",
75
85
  "cls": "function",
76
86
  "length": 2,
77
- "arity": 2
87
+ "arity": 2,
88
+ "description": "Returns true if the first value is greater than the second."
78
89
  },
79
- "ge" : {
90
+ "ge": {
80
91
  "tk": 1,
81
92
  "name": "GE",
82
93
  "cls": "function",
83
94
  "length": 2,
84
- "arity": 2
95
+ "arity": 2,
96
+ "description": "Returns true if the first value is greater than or equal to the second."
85
97
  },
86
- "ne" : {
98
+ "ne": {
87
99
  "tk": 1,
88
100
  "name": "NE",
89
101
  "cls": "function",
90
102
  "length": 2,
91
- "arity": 2
103
+ "arity": 2,
104
+ "description": "Returns true if the two values are not equal."
92
105
  },
93
- "len" : {
106
+ "len": {
94
107
  "tk": 1,
95
108
  "name": "LEN",
96
109
  "cls": "function",
97
110
  "length": 1,
98
- "arity": 1
111
+ "arity": 1,
112
+ "description": "Returns the length of a list or string."
99
113
  },
100
- "concat" : {
114
+ "concat": {
101
115
  "tk": 1,
102
116
  "name": "CONCAT",
103
117
  "cls": "function",
104
118
  "length": 1,
105
- "arity": 1
119
+ "arity": 1,
120
+ "description": "Concatenates a list of strings or nested lists."
106
121
  },
107
- "add" : {
122
+ "add": {
108
123
  "tk": 1,
109
124
  "name": "ADD",
110
125
  "cls": "function",
111
126
  "length": 2,
112
- "arity": 2
127
+ "arity": 2,
128
+ "description": "Adds two numbers."
113
129
  },
114
- "mul" : {
130
+ "mul": {
115
131
  "tk": 1,
116
132
  "name": "MUL",
117
133
  "cls": "function",
118
134
  "length": 2,
119
- "arity": 2
135
+ "arity": 2,
136
+ "description": "Multiplies two numbers."
120
137
  },
121
- "pow" : {
138
+ "pow": {
122
139
  "tk": 1,
123
140
  "name": "POW",
124
141
  "cls": "function",
125
142
  "length": 2,
126
- "arity": 2
127
- },
128
- "map" : {
129
- "tk": 1,
130
- "name": "MAP",
131
- "cls": "function",
132
- "length": 2,
133
- "arity": 2
143
+ "arity": 2,
144
+ "description": "Raises the first number to the power of the second."
134
145
  },
135
- "apply" : {
146
+ "apply": {
136
147
  "tk": 1,
137
148
  "name": "APPLY",
138
149
  "cls": "function",
139
150
  "length": 2,
140
- "arity": 2
151
+ "arity": 2,
152
+ "description": "Applies a function to a list of arguments."
141
153
  },
142
- "data" : {
154
+ "data": {
143
155
  "tk": 1,
144
156
  "name": "DATA",
145
157
  "cls": "function",
146
158
  "length": 1,
147
- "arity": 1
159
+ "arity": 1,
160
+ "description": "Returns the raw data payload from a structured input."
148
161
  },
149
- "json" : {
162
+ "json": {
150
163
  "tk": 1,
151
164
  "name": "JSON",
152
165
  "cls": "function",
153
166
  "length": 1,
154
- "arity": 1
167
+ "arity": 1,
168
+ "description": "Parses a string as JSON or serializes a value to JSON."
155
169
  },
156
- "eq" : {
170
+ "eq": {
157
171
  "tk": 1,
158
172
  "name": "EQ",
159
173
  "cls": "function",
160
174
  "length": 2,
161
- "arity": 2
175
+ "arity": 2,
176
+ "description": "Returns true if the two values are equal."
162
177
  },
163
- "mod" : {
178
+ "mod": {
164
179
  "tk": 1,
165
180
  "name": "MOD",
166
181
  "cls": "function",
167
182
  "length": 2,
168
- "arity": 2
183
+ "arity": 2,
184
+ "description": "Returns the remainder of dividing the first number by the second."
169
185
  },
170
- "min" : {
186
+ "min": {
171
187
  "tk": 1,
172
188
  "name": "MIN",
173
189
  "cls": "function",
174
190
  "length": 2,
175
- "arity": 2
191
+ "arity": 2,
192
+ "description": "Returns the smaller of two values."
176
193
  },
177
- "max" : {
194
+ "max": {
178
195
  "tk": 1,
179
196
  "name": "MAX",
180
197
  "cls": "function",
181
198
  "length": 2,
182
- "arity": 2
199
+ "arity": 2,
200
+ "description": "Returns the larger of two values."
183
201
  },
184
- "range" : {
202
+ "range": {
185
203
  "tk": 1,
186
204
  "name": "RANGE",
187
205
  "cls": "function",
188
206
  "length": 3,
189
- "arity": 3
207
+ "arity": 3,
208
+ "description": "Generates a list of numbers from start to end using a step."
190
209
  },
191
- "not" : {
210
+ "not": {
192
211
  "tk": 1,
193
212
  "name": "NOT",
194
213
  "cls": "function",
195
214
  "length": 1,
196
- "arity": 1
215
+ "arity": 1,
216
+ "description": "Returns the logical negation of a boolean value."
197
217
  },
198
- "equiv" : {
218
+ "equiv": {
199
219
  "tk": 1,
200
220
  "name": "EQUIV",
201
221
  "cls": "function",
202
222
  "length": 2,
203
- "arity": 2
223
+ "arity": 2,
224
+ "description": "Returns true if the two values are semantically equivalent."
204
225
  },
205
- "or" : {
226
+ "or": {
206
227
  "tk": 1,
207
228
  "name": "OR",
208
229
  "cls": "function",
209
230
  "length": 2,
210
- "arity": 2
231
+ "arity": 2,
232
+ "description": "Returns true if at least one of the two values is true."
211
233
  },
212
- "and" : {
234
+ "and": {
213
235
  "tk": 1,
214
236
  "name": "AND",
215
237
  "cls": "function",
216
238
  "length": 2,
217
- "arity": 2
239
+ "arity": 2,
240
+ "description": "Returns true if both values are true."
218
241
  },
219
- "hd" : {
242
+ "hd": {
220
243
  "tk": 1,
221
244
  "name": "HD",
222
245
  "cls": "function",
223
246
  "length": 1,
224
- "arity": 1
247
+ "arity": 1,
248
+ "description": "Returns the first element of a list."
225
249
  },
226
- "tl" : {
250
+ "tl": {
227
251
  "tk": 1,
228
252
  "name": "TL",
229
253
  "cls": "function",
230
254
  "length": 1,
231
- "arity": 1
255
+ "arity": 1,
256
+ "description": "Returns the list without its first element."
257
+ },
258
+ "cons": {
259
+ "tk": 1,
260
+ "name": "CONS",
261
+ "cls": "function",
262
+ "length": 2,
263
+ "arity": 2,
264
+ "description": "Prepends an element to the front of a list."
265
+ },
266
+ "append": {
267
+ "tk": 1,
268
+ "name": "APPEND",
269
+ "cls": "function",
270
+ "length": 2,
271
+ "arity": 2,
272
+ "description": "Appends an element to the end of a list."
232
273
  }
233
- }
274
+ };