aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-07 20:59:33 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-07 21:00:20 -0400
commit9349cb822b44960aa6072063061ad49d00b73833 (patch)
tree6647f063a839904f6b0a6f8a542c5bef8f1d7d85
parenteb3bbecda0624c44898abeb162c554192ef07c64 (diff)
Functions in trains can all be dervs
-rw-r--r--spec/evaluate.md4
-rw-r--r--spec/grammar.md8
2 files changed, 6 insertions, 6 deletions
diff --git a/spec/evaluate.md b/spec/evaluate.md
index d4e345d9..6442a499 100644
--- a/spec/evaluate.md
+++ b/spec/evaluate.md
@@ -40,7 +40,7 @@ The following rules derive new functions or operators from existing ones.
|------------|-----------|---------------------|--------------
| | `_comp_` | `( value \| Func )` | `{š”½ _C_ R}`
| `Operand` | `_comp_` | | `{L _C_ š”½}`
-| `Operand` | `Func` | `Fork` | `{(š•ØLš•©)C(š•ØRš•©)}`
-| `nothing?` | `Func` | `Fork` | `{ C(š•ØRš•©)}`
+| `Operand` | `Derv` | `Fork` | `{(š•ØLš•©)C(š•ØRš•©)}`
+| `nothing?` | `Derv` | `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.
diff --git a/spec/grammar.md b/spec/grammar.md
index 082e8e14..fe20e103 100644
--- a/spec/grammar.md
+++ b/spec/grammar.md
@@ -36,11 +36,11 @@ Functions can be formed by fully applying operators or as trains. Operators are
| Operand _comp_ ( value | Func )
Operand = value
| Derv
- Fork = Func
- | Operand Func Fork # 3-train
- | nothing Func Fork # 2-train
+ Fork = Derv
+ | Operand Derv Fork # 3-train
+ | nothing Derv Fork # 2-train
Train = Fork
- | Func Fork # 2-train
+ | Derv Fork # 2-train
FuncExpr = Train
| F ASGN FuncExpr