You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/6MAT.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,14 +43,14 @@ Instruction arguments are denoted in this document and the instruction grammar u
43
43
-`!V`: A character literal, `$V`, or `?V`
44
44
-`$V`: A character literal, or `$V`
45
45
-`'C`: A character literal
46
-
-`!n`: A string literal, or `$n`, or `?n`
46
+
-`!n`: A string literal, `$n`, or `?n`
47
47
-`$n`: A string literal, or `$n`
48
48
-`"X`: A string literal
49
49
-`_I`: Any previously listed type (with potential restrictions)
50
50
51
51
Default values for arguments are denoted like `_I = default`. Passing `NIL` as an argument is equivalent to passing the default value. If an instruction has adjacent defaulted arguments of the same type, they are bound from left to right; e.g. if `FOO %N = 1, %M = 2` is called with `FOO 3`, then `3` is bound to `%N`.
52
52
53
-
Multiple `!n` arguments are never permitted in a single instruction call. If an instruction accepts `!n` and `"X` in a call, `n` must be the length of the string literal.
53
+
Multiple `!n` arguments are never permitted in a single instruction call. If an instruction accepts `!n` and `"X` in a call, `n` must be the length of the string literal. Passing `!n` when fewer than `n` characters remain on the tape will result in a crash.
54
54
55
55
## Control Flow
56
56
@@ -156,6 +156,8 @@ As such, the following calls are disallowed.
156
156
-`IFLE! $V, !V { ... }`
157
157
-`IFLT! $V, !V { ... }`
158
158
159
+
Furthermore, peeking in the second argument is somewhat inefficient in the general case to account for the tape pointer being near the end of the tape. Prefer using `$V` and backing up manually based on prior knowledge of the tape pointer.
160
+
159
161
#### `LOOP { ... }`
160
162
Repeatedly execute the block, terminating if the tape is exhausted at the top of the block. Note that the tape pointer does *not* move by default at any point, and thus failing to cause net movement of the tape pointer during execution will result in a crash.
161
163
@@ -293,7 +295,7 @@ As such, the following calls are disallowed.
293
295
294
296
## Printing
295
297
296
-
**Printing** a character results in its appearance in the next contents of the tape; it is only **output** to STDOUT at the end of the current lifetime if it appears after the last `\f` character. Printed characters cannot be overwritten or undone within a lifetime.
298
+
**Printing** a character results in its appearance in the next contents of the tape; it is only **output** to STDOUT at the end of the current lifetime if it appears after the last `\f` character. Printed characters *cannot* be overwritten or undone within a lifetime.
297
299
298
300
#### `PRINA _I`
299
301
Print `_I` as it appears, which may be a character or string variable.
@@ -331,7 +333,7 @@ Print `_K` using `PRINz _K` if the tape pointer is at the end of the tape (i.e.
331
333
**Copying** instructions print some span of the tape without modification.
332
334
333
335
#### `COPY +N = 1`
334
-
Copy exactly `N` characters. Equivalent to (but more readable than) [`PRINA $N`](#prina-_i).
336
+
Copy exactly `N` characters (or until the tape is exhausted). More efficient than [`PRINA +N`](#prina-_i) in the case that at least `N` characters remain on the tape (i.e. `$R >= N`), and will not crash.
335
337
336
338
#### `COPYC! 'C, +N = 1`
337
339
Copy characters up to but not including the `N`th succeeding appearance of `C`.
@@ -392,7 +394,7 @@ The value of `z` dictates padding options at the edges of the field.
392
394
|`JUSTC`| Padding may be added at either edge of the field |
393
395
394
396
```
395
-
JUST %N, %M, %L, !V {
397
+
JUSTz %N, %M, %L, !V {
396
398
[{ ... }]
397
399
[{ ... }]
398
400
...
@@ -407,7 +409,7 @@ Create a buffer by executing the block. If the output of the containing [`JUST`]
407
409
Since this clause is always executed, breaking out of it cancels the entirety of the containing `JUST` instruction. Tape pointer movement is not undone.
0 commit comments