Tacit programming: Difference between revisions

Jump to navigation Jump to search
41 bytes removed ,  04:26, 11 August 2020
add -trains=parens
(→‎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 analyzed like this:
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
│Was OFF│
└───────┘
       ((+.×⍨⊢~∘.×⍨)1↓⍳)    ⍝ the train to be analysed
       ((+.×⍨⊢~∘.×⍨)1↓⍳)    ⍝ the train to be analysed
┌───────────────────────────────┬───────┐
┌───────────────────────────────┬───────┐
│┌───────────┬─────────────────┐│┌─┬─┬─┐│
│┌───────────┬─────────────────┐│┌─┬─┬─┐│
││┌───────┬─┐│┌─┬─┬───────────┐│││ │↓│⍳││
││┌───────┬─┐│┌─┬─┬───────────┐│││1│↓│⍳││
│││┌─┬─┬─┐│⍨│││⊢│~│┌───────┬─┐││││1│ │ ││
│││┌─┬─┬─┐│⍨│││⊢│~│┌───────┬─┐│││└─┴─┴─┘│
││││+│.│×││ │││ │ ││┌─┬─┬─┐│⍨│││││ │ ││
││││+│.│×││ │││ │ ││┌─┬─┬─┐│⍨││││     
│││└─┴─┴─┘│ │││ │ │││∘│.│×││ ││││└─┴─┴─┘│
│││└─┴─┴─┘│ │││ │ │││∘│.│×││ ││││      │
││└───────┴─┘││ │ ││└─┴─┴─┘│ ││││      │
││└───────┴─┘││ │ ││└─┴─┴─┘│ ││││      │
││          ││ │ │└───────┴─┘│││      │
││          ││ │ │└───────┴─┘│││      │
Line 83: Line 81:
<source lang=apl>
<source lang=apl>
       ]Boxing on -trains=tree
       ]Boxing on -trains=tree
┌→─────────────────┐
Was ON -trains=box
│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>


Navigation menu