4,509
edits
(→Debugging: new section) |
(add -trains=parens) |
||
Line 60: | Line 60: | ||
In [[Dyalog APL]], analysis of trains is assisted by a [[user command]] <source lang=apl inline>]Boxing on</source>. This is achieved by executing the command <source lang=apl inline>]Boxing on</source> and then entering a train without any parameters. A structure of the train will be displayed. | In [[Dyalog APL]], analysis of trains is assisted by a [[user command]] <source lang=apl inline>]Boxing on</source>. This is achieved by executing the command <source lang=apl inline>]Boxing on</source> and then entering a train without any parameters. A structure of the train will be displayed. | ||
For example, the "accursed train" from the section below can be | For example, the "accursed train" from the section below can be analysed like this: | ||
<source lang=apl> | <source lang=apl> | ||
]Boxing on | ]Boxing on | ||
Was OFF | |||
((+.×⍨⊢~∘.×⍨)1↓⍳) ⍝ the train to be analysed | ((+.×⍨⊢~∘.×⍨)1↓⍳) ⍝ the train to be analysed | ||
┌───────────────────────────────┬───────┐ | ┌───────────────────────────────┬───────┐ | ||
│┌───────────┬─────────────────┐│┌─┬─┬─┐│ | │┌───────────┬─────────────────┐│┌─┬─┬─┐│ | ||
││┌───────┬─┐│┌─┬─┬───────────┐│││1│↓│⍳││ | |||
│││┌─┬─┬─┐│⍨│││⊢│~ | │││┌─┬─┬─┐│⍨│││⊢│~│┌───────┬─┐│││└─┴─┴─┘│ | ||
││││+│.│×││ │││ │ | ││││+│.│×││ │││ │ ││┌─┬─┬─┐│⍨││││ │ | ||
│││└─┴─┴─┘│ │││ │ │││∘│.│×││ | │││└─┴─┴─┘│ │││ │ │││∘│.│×││ ││││ │ | ||
││└───────┴─┘││ │ ││└─┴─┴─┘│ ││││ │ | ││└───────┴─┘││ │ ││└─┴─┴─┘│ ││││ │ | ||
││ ││ │ │└───────┴─┘│││ │ | ││ ││ │ │└───────┴─┘│││ │ | ||
Line 83: | Line 81: | ||
<source lang=apl> | <source lang=apl> | ||
]Boxing on -trains=tree | ]Boxing on -trains=tree | ||
Was ON -trains=box | |||
((+.×⍨⊢~∘.×⍨)1↓⍳) ⍝ the train to be analysed | ((+.×⍨⊢~∘.×⍨)1↓⍳) ⍝ the train to be analysed | ||
┌───┴───┐ | ┌───┴───┐ | ||
Line 95: | Line 91: | ||
+ × ┌┴┐ | + × ┌┴┐ | ||
∘ × | ∘ × | ||
</source> | |||
Or fully parenthesised: | |||
<source lang=apl> | |||
((+.×⍨⊢~∘.×⍨)1↓⍳) ⍝ the train to be analysed | |||
(((+.×)⍨)(⊢~((∘.×)⍨)))(1↓⍳) | |||
</source> | </source> | ||