diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-01-21 20:41:53 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-01-21 20:41:53 -0500 |
| commit | f31934418dadd7fd7e5ea31634a40d3e9e4edfdc (patch) | |
| tree | f178922f1c6b3e9d1dfb5db5739930ae9706deee | |
| parent | 0000f894faae0daf7a3ee362abc9054697b513e4 (diff) | |
Fill for a string literal is a character
| -rw-r--r-- | docs/spec/inferred.html | 1 | ||||
| -rw-r--r-- | spec/inferred.md | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/docs/spec/inferred.html b/docs/spec/inferred.html index 34d4725d..251c35c4 100644 --- a/docs/spec/inferred.html +++ b/docs/spec/inferred.html @@ -71,6 +71,7 @@ <h2 id="fill-elements">Fill elements</h2> <p>Any BQN array can have a <em>fill element</em>, which is a sort of "default" value for the array. The reference implementations use <code><span class='Function'>Fill</span></code> to access this element, and it is used primarily for Take (<code><span class='Function'>↑</span></code>), First (<code><span class='Function'>⊑</span></code>), and Nudge (<code><span class='Function'>«</span></code>, <code><span class='Function'>»</span></code>). One way to extract the fill element of an array <code><span class='Value'>a</span></code> in BQN is <code><span class='Function'>⊑</span><span class='Number'>0</span><span class='Function'>⥊</span><span class='Value'>a</span></code>.</p> <p>A fill element can be either <code><span class='Number'>0</span></code>, <code><span class='String'>' '</span></code>, or an array of valid fill elements. If the fill element is an array, then it may also have a fill element (since it is an ordinary BQN array). The fill element is meant to describe the shared structure of the elements of an array: for example, the fill element of an array of numbers should be <code><span class='Number'>0</span></code>, while the fill element for an array of variable-length lists should probably be <code><span class='Bracket'>⟨⟩</span></code>. However, the fill element, unlike other inferred properties, does not satisfy any particular constraints that relate it to its array.</p> +<p>In addition to the requirements below, the fill element for the value of a string literal is <code><span class='String'>' '</span></code>.</p> <h3 id="required-functions">Required functions</h3> <p>Combinators <code><span class='Function'>⊣⊢!</span><span class='Modifier'>˙˜´˝</span><span class='Modifier2'>∘○⊸⟜⊘◶⍟</span></code> do not affect fill element computation: if the combinator calls a function that computes a fill element, then that fill element must be retained if the result is passed to other functions or returned. <code><span class='Modifier2'>⍟</span></code> constructs arrays if its right operand is or contains arrays, and the fill elements of these arrays are not specified; converting <code><span class='Value'>𝕩</span></code> to a fill element is a reasonable choice in some cases but not others.</p> <p>Arithmetic primitives—all valences of <code><span class='Function'>+-×÷⋆√⌊⌈|¬∧∨</span></code> and dyadic <code><span class='Function'><>≠=≤≥</span></code>—obtain their fill elements by applying to the fill elements of the arguments. If this is an error, there is no fill element; otherwise, the fill element is the result, with all numbers in it changed to <code><span class='Number'>0</span></code> and all characters changed to <code><span class='String'>' '</span></code>.</p> diff --git a/spec/inferred.md b/spec/inferred.md index ae2ccd05..4b729225 100644 --- a/spec/inferred.md +++ b/spec/inferred.md @@ -36,6 +36,8 @@ Any BQN array can have a *fill element*, which is a sort of "default" value for A fill element can be either `0`, `' '`, or an array of valid fill elements. If the fill element is an array, then it may also have a fill element (since it is an ordinary BQN array). The fill element is meant to describe the shared structure of the elements of an array: for example, the fill element of an array of numbers should be `0`, while the fill element for an array of variable-length lists should probably be `⟨⟩`. However, the fill element, unlike other inferred properties, does not satisfy any particular constraints that relate it to its array. +In addition to the requirements below, the fill element for the value of a string literal is `' '`. + ### Required functions Combinators `⊣⊢!˙˜´˝∘○⊸⟜⊘◶⍟` do not affect fill element computation: if the combinator calls a function that computes a fill element, then that fill element must be retained if the result is passed to other functions or returned. `⍟` constructs arrays if its right operand is or contains arrays, and the fill elements of these arrays are not specified; converting `𝕩` to a fill element is a reasonable choice in some cases but not others. |
