diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-07-13 16:37:06 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-07-13 17:30:24 -0400 |
| commit | aaac31f1668fe5516902ee7d2034e5c0e41667a6 (patch) | |
| tree | fa20c0a1d8cdee2de4d8ae1a4aa87bca5ac29256 /doc/functional.md | |
| parent | 80cab4ef3a715ae98eefcbea947269d731b04b2e (diff) | |
Support line breaks inside brackets in markdown BQN evaluation
Diffstat (limited to 'doc/functional.md')
| -rw-r--r-- | doc/functional.md | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/doc/functional.md b/doc/functional.md index cd7656ca..7f44f877 100644 --- a/doc/functional.md +++ b/doc/functional.md @@ -102,14 +102,13 @@ What does functional programming in BQN look like? How is it different from the First, let's look at the basics: a small program that has functions as its argument and result. The function `Lin` below gives a [linear approximation](https://en.wikipedia.org/wiki/Linear_approximation) to its function argument based on the values at 0 and 1. To find these two values, we call the argument as a function by using its uppercase spelling, `𝕏`. - Lin ← { - v0 ← 𝕏 0 - v0 + ((𝕏 1) - v0) × ⊢ - } + Lin ← { + v0 ← 𝕏 0 + v0 + ((𝕏 1) - v0) × ⊢ + } We can pass it the [exponential](arithmetic.md#basic-arithmetic) function as an argument by giving it the name `Exp` and then referring to it in lowercase (that is, in a subject role). The result is a [train](train.md) that adds 1 to *e*-1 times the argument (we'll discuss only tacit functions here; for blocks see [lexical scoping](lexical.md)). - Lin ← { v0←𝕏0 ⋄ v0+((𝕏1)-v0)×⊢ } # (copy of above) Exp ← ⋆ Lin exp @@ -128,14 +127,13 @@ Not the most accurate approximation, though. Note also in this case that we could have used a modifier with a very similar definition to `Lin`. The modifier is identical in definition except that `𝕏` is replaced with `𝔽`. - _lin ↩ { - v0 ← 𝔽 0 - v0 + ((𝔽 1) - v0) × ⊢ - } + _lin ↩ { + v0 ← 𝔽 0 + v0 + ((𝔽 1) - v0) × ⊢ + } Its call syntax is simpler as well. In other cases, however, the function version might be preferable, for example when dealing with arrays of functions or many arguments including a function. - _lin ↩ { v0←𝔽0 ⋄ v0+((𝔽1)-v0)×⊢ } # (copy again) Exp _lin 5 ### Arrays of functions |
