diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-06-26 20:32:46 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-06-26 20:32:46 -0400 |
| commit | adc8dfaace36ecf40b80f5ef460c5084f82f7d22 (patch) | |
| tree | bdcd4f772b33db6c19d57df67c99ad2d43b0f5e0 /spec/evaluate.md | |
| parent | 55b3298701bcd1e3b5c4c2b4383f823511560f1c (diff) | |
Allow nothing (ยท) as left tine of a fork
Diffstat (limited to 'spec/evaluate.md')
| -rw-r--r-- | spec/evaluate.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/evaluate.md b/spec/evaluate.md index ba6830d5..03edc813 100644 --- a/spec/evaluate.md +++ b/spec/evaluate.md @@ -22,11 +22,11 @@ Rules in the table below are function and operator evaluation. In each case the constituent expressions are evaluated in reverse source order: Right, then Called, then Left. Then the expression's result is obtained by calling the Called value on its parameters. A left argument of `nothing` is not used as a parameter, leaving only a right argument in that case. The data type of the Called value must be appropriate to the expression type, as indicated in the "Types" column. For function application, a value type (number, character, or array) is allowed. It is called simply by returning itself. Although the arguments are ignored in this case, they are still evaluated. A braced construct is evaluated by binding the parameter names given in columns L and R to the corresponding values. Then if all parameter levels present have been bound, its body is evaluated to give the result of application. The following rules derive new functions or operators from existing ones. -| Left | Center | Right | Result -|-----------|-----------|---------------------|-------------- -| | `_comp_` | `( value \| Func )` | `{๐ฝ _C_ R}` -| `Operand` | `_comp_` | | `{L _C_ ๐ฝ}` -| `Operand` | `Func` | `Fork` | `{(๐จL๐ฉ)C(๐จR๐ฉ)}` -| | `Func` | `Fork` | `{ C(๐จR๐ฉ)}` +| Left | Center | Right | Result +|------------|-----------|---------------------|-------------- +| | `_comp_` | `( value \| Func )` | `{๐ฝ _C_ R}` +| `Operand` | `_comp_` | | `{L _C_ ๐ฝ}` +| `Operand` | `Func` | `Fork` | `{(๐จL๐ฉ)C(๐จR๐ฉ)}` +| `nothing?` | `Func` | `Fork` | `{ C(๐จR๐ฉ)}` As with applications, all expressions are evaluated in reverse source order before doing anything else. Then a result is formed without calling the center value. Its value in BQN is given in the rightmost column, using `L`, `C`, and `R` for the results of the expressions in the left, center, and right columns, respectively. For the first two rules (*partial application*), the given operand is bound to the composition: the result is a modifier that, when called, calls the center composition with the bound operand on the same side it appeared on and the new operand on the remaining side. A *train* is a function that, when called, calls the right-hand function on all arguments, then the left-hand function, and calls the center function with these results as arguments. In a composition partial application, the result will fail when applied if the center value does not have the composition type, and in a fork, it will fail if any component has a modifier or composition type (that is, cannot be applied as a function). BQN implementations are not required to check for these types when forming the result of these expressions, but may give an error on formation even if the result will never be applied. |
