diff options
| -rw-r--r-- | doc/fromJ.md | 29 | ||||
| -rw-r--r-- | docs/doc/fromJ.html | 88 |
2 files changed, 112 insertions, 5 deletions
diff --git a/doc/fromJ.md b/doc/fromJ.md index 53565405..c7d7c153 100644 --- a/doc/fromJ.md +++ b/doc/fromJ.md @@ -74,9 +74,9 @@ Functions `+` `-` `|` `<` `>` are the same in both languages. Most of BQN's combinators have J equivalents. The J equivalent `"_` for `˙` assumes a noun operand, but `˙` makes a constant function for any operand. `◶` has arguments reversed relative to `@.`, and uses an actual array of functions rather than gerunds. Besides these, BQN's `⟜` is like a J hook, that is, `F⟜G` is `(F G)`, and `⊸` applies in the opposite direction. -| BQN | `˙` | `˜` | `∘` | `○` | `⌾` | `⊘` | `◶` | -|:---:|:----:|:---:|:----:|:----:|:-----:|:---:|:----:| -| J | `"_` | `~` | `@:` | `&:` | `&.:` | `:` | `@.` | +| BQN | `˙` | `˜` | `∘` | `○` | `⌾` | `⊘` | `◶` | `⎊` | +|:---:|:----:|:---:|:----:|:----:|:-----:|:---:|:----:|:----:| +| J | `"_` | `~` | `@:` | `&:` | `&.:` | `:` | `@.` | `::` | For other modifiers the correspondence is looser. Here `⌜` shows the dyadic case and `´` the monadic case only. @@ -101,6 +101,10 @@ Some other primitives are essentially the same in J and BQN, but with different |:---:|:---:|:---:|:---:|:----:|:----:|:----:|:----:|:---:|:---:|:-----:|:-----:| | BQN | `×` | `÷` | `⋆` | `⋆⁼` | `√` | `⌊` | `⌈` | `⊣` | `⊢` | `⌽` | `⍉` | +| J | `~` | `@:` | `&:` | `&.:` | `:` | `/` | `"` | `L:` | `^:` | +|:---:|:---:|:----:|:----:|:-----:|:---:|:---:|:---:|:----:|:----:| +| BQN | `˜` | `∘` | `○` | `⌾` | `⊘` | `˝` | `⎉` | `⚇` | `⍟` | + Additionally, `|.!.f` is `⥊⟜f⊸«` with a natural number left argument. Change `«` to `»` to rotate right instead of left. The tables below give approximate implementations of J primitives. J has a whole lot of complicated primitives that no one uses (some of which are officially deprecated), so not everything is translated here. @@ -137,7 +141,24 @@ The tables below give approximate implementations of J primitives. J has a whole | `}:` | `¯1⊸↓` | | `e.` | `><∘∾∊¨⊢` | `∊` | `E.` | | `⍷` -| `i.` | `↕` | `⊐` +| `i.` | `↕` (`⥊⟜(↕×´)` for lists) | `⊐` | `i:` | `{𝕩-˜↕1+2×𝕩}` | `≠∘⊣-1+⌽⊸⊐` | `I.` | `/` | `⍋` | `L.` | `≡` | + +Some J modifier expressions are translated below. BQN doesn't keep track of the rank of functions, so the "close" compositions `@` `&` `&.` have no BQN equivalents: instead, specify a rank after composing. + +| J | BQN +|----------------|----- +| `&.>` | `¨` +| `` F`G`H@.C `` | `C◶⟨F,G,H⟩` +| `x y} z` | `x⌾(y⊸⊏) z` +| `F/ .G` | `F˝∘G⎉1‿∞` (dyadic) + +BQN uses functions, not modifiers, for structural manipulation. The following table gives BQN functions corresponding to J's structural modifiers. The result is an array of arrays; use `F¨` to apply a function to each of these, and `>F¨` to apply a function and merge the results into a single array. + +| J | Monad | Dyad +|------|---------------|------ +| `/.` | `(+⌜´↕¨∘≢)⊸⊔` | `⊐⊸⊔` +| `\` | `1↓↑` | `<˘↕` +| `\.` | `¯1↓↓` | diff --git a/docs/doc/fromJ.html b/docs/doc/fromJ.html index 72d4f59b..432bf72f 100644 --- a/docs/doc/fromJ.html +++ b/docs/doc/fromJ.html @@ -279,6 +279,7 @@ <th align="center"><code><span class='Modifier2'>⌾</span></code></th> <th align="center"><code><span class='Modifier2'>⊘</span></code></th> <th align="center"><code><span class='Modifier2'>◶</span></code></th> +<th align="center"><code><span class='Modifier2'>⎊</span></code></th> </tr> </thead> <tbody> @@ -291,6 +292,7 @@ <td align="center"><code><span class='Value'>&</span><span class='Number'>.</span><span class='Value'>:</span></code></td> <td align="center"><code><span class='Value'>:</span></code></td> <td align="center"><code><span class='String'>@</span><span class='Number'>.</span></code></td> +<td align="center"><code><span class='Value'>::</span></code></td> </tr> </tbody> </table> @@ -383,6 +385,36 @@ </tr> </tbody> </table> +<table> +<thead> +<tr> +<th align="center">J</th> +<th align="center"><code><span class='Value'>~</span></code></th> +<th align="center"><code><span class='String'>@</span><span class='Value'>:</span></code></th> +<th align="center"><code><span class='Value'>&:</span></code></th> +<th align="center"><code><span class='Value'>&</span><span class='Number'>.</span><span class='Value'>:</span></code></th> +<th align="center"><code><span class='Value'>:</span></code></th> +<th align="center"><code><span class='Function'>/</span></code></th> +<th align="center"><code><span class='String'>"</span></code></th> +<th align="center"><code><span class='Function'>L</span><span class='Value'>:</span></code></th> +<th align="center"><code><span class='Value'>^:</span></code></th> +</tr> +</thead> +<tbody> +<tr> +<td align="center">BQN</td> +<td align="center"><code><span class='Modifier'>˜</span></code></td> +<td align="center"><code><span class='Modifier2'>∘</span></code></td> +<td align="center"><code><span class='Modifier2'>○</span></code></td> +<td align="center"><code><span class='Modifier2'>⌾</span></code></td> +<td align="center"><code><span class='Modifier2'>⊘</span></code></td> +<td align="center"><code><span class='Modifier'>˝</span></code></td> +<td align="center"><code><span class='Modifier2'>⎉</span></code></td> +<td align="center"><code><span class='Modifier2'>⚇</span></code></td> +<td align="center"><code><span class='Modifier2'>⍟</span></code></td> +</tr> +</tbody> +</table> <p>Additionally, <code><span class='Function'>|</span><span class='Number'>.</span><span class='Function'>!</span><span class='Number'>.f</span></code> is <code><span class='Function'>⥊</span><span class='Modifier2'>⟜</span><span class='Value'>f</span><span class='Modifier2'>⊸</span><span class='Function'>«</span></code> with a natural number left argument. Change <code><span class='Function'>«</span></code> to <code><span class='Function'>»</span></code> to rotate right instead of left.</p> <p>The tables below give approximate implementations of J primitives. J has a whole lot of complicated primitives that no one uses (some of which are officially deprecated), so not everything is translated here.</p> <table> @@ -546,7 +578,7 @@ </tr> <tr> <td><code><span class='Value'>i.</span></code></td> -<td><code><span class='Function'>↕</span></code></td> +<td><code><span class='Function'>↕</span></code> (<code><span class='Function'>⥊</span><span class='Modifier2'>⟜</span><span class='Paren'>(</span><span class='Function'>↕×</span><span class='Modifier'>´</span><span class='Paren'>)</span></code> for lists)</td> <td><code><span class='Function'>⊐</span></code></td> </tr> <tr> @@ -566,3 +598,57 @@ </tr> </tbody> </table> +<p>Some J modifier expressions are translated below. BQN doesn't keep track of the rank of functions, so the "close" compositions <code><span class='String'>@</span></code> <code><span class='Value'>&</span></code> <code><span class='Value'>&</span><span class='Number'>.</span></code> have no BQN equivalents: instead, specify a rank after composing.</p> +<table> +<thead> +<tr> +<th>J</th> +<th>BQN</th> +</tr> +</thead> +<tbody> +<tr> +<td><code><span class='Value'>&</span><span class='Number'>.</span><span class='Function'>></span></code></td> +<td><code><span class='Modifier'>¨</span></code></td> +</tr> +<tr> +<td><code><span class='Function'>F</span><span class='Modifier'>`</span><span class='Function'>G</span><span class='Modifier'>`</span><span class='Function'>H</span><span class='String'>@</span><span class='Number'>.C</span></code></td> +<td><code><span class='Function'>C</span><span class='Modifier2'>◶</span><span class='Bracket'>⟨</span><span class='Function'>F</span><span class='Separator'>,</span><span class='Function'>G</span><span class='Separator'>,</span><span class='Function'>H</span><span class='Bracket'>⟩</span></code></td> +</tr> +<tr> +<td><code><span class='Value'>x</span> <span class='Value'>y</span><span class='Brace'>}</span> <span class='Value'>z</span></code></td> +<td><code><span class='Value'>x</span><span class='Modifier2'>⌾</span><span class='Paren'>(</span><span class='Value'>y</span><span class='Modifier2'>⊸</span><span class='Function'>⊏</span><span class='Paren'>)</span> <span class='Value'>z</span></code></td> +</tr> +<tr> +<td><code><span class='Function'>F/</span> <span class='Number'>.G</span></code></td> +<td><code><span class='Function'>F</span><span class='Modifier'>˝</span><span class='Modifier2'>∘</span><span class='Function'>G</span><span class='Modifier2'>⎉</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>∞</span></code> (dyadic)</td> +</tr> +</tbody> +</table> +<p>BQN uses functions, not modifiers, for structural manipulation. The following table gives BQN functions corresponding to J's structural modifiers. The result is an array of arrays; use <code><span class='Function'>F</span><span class='Modifier'>¨</span></code> to apply a function to each of these, and <code><span class='Function'>>F</span><span class='Modifier'>¨</span></code> to apply a function and merge the results into a single array.</p> +<table> +<thead> +<tr> +<th>J</th> +<th>Monad</th> +<th>Dyad</th> +</tr> +</thead> +<tbody> +<tr> +<td><code><span class='Function'>/</span><span class='Number'>.</span></code></td> +<td><code><span class='Paren'>(</span><span class='Function'>+</span><span class='Modifier'>⌜´</span><span class='Function'>↕</span><span class='Modifier'>¨</span><span class='Modifier2'>∘</span><span class='Function'>≢</span><span class='Paren'>)</span><span class='Modifier2'>⊸</span><span class='Function'>⊔</span></code></td> +<td><code><span class='Function'>⊐</span><span class='Modifier2'>⊸</span><span class='Function'>⊔</span></code></td> +</tr> +<tr> +<td><code><span class='Value'>\</span></code></td> +<td><code><span class='Number'>1</span><span class='Function'>↓↑</span></code></td> +<td><code><span class='Function'><</span><span class='Modifier'>˘</span><span class='Function'>↕</span></code></td> +</tr> +<tr> +<td><code><span class='Value'>\</span><span class='Number'>.</span></code></td> +<td><code><span class='Number'>¯1</span><span class='Function'>↓↓</span></code></td> +<td></td> +</tr> +</tbody> +</table> |
