⍝ enclose-if-simple / link:

    eis 'hello'                     ⍝ simple array enclosed
┌─────┐
│hello│
└─────┘
    eis 'hello' 'world'             ⍝ nested array: no-op
┌─────┬─────┐
│hello│world│
└─────┴─────┘
    eis 'h'                         ⍝ simple scalar: raveled and enclosed !!
┌─┐
│h│
└─┘
    eis ↑'hello' 'world'            ⍝ simple matrix: enclosed
┌─────┐
│hello│
│world│
└─────┘
    'this' eis 'and' eis 'that'     ⍝ sequence of simple vectors
┌────┬───┬────┐
│this│and│that│
└────┴───┴────┘
    'aa' 'bb' eis 'cc' 'dd' eis 'ee' 'ff'   ⍝ nested sequence
┌──┬──┬──┬──┬──┬──┐
│aa│bb│cc│dd│ee│ff│
└──┴──┴──┴──┴──┴──┘

    Beatles ← 'John' 'Paul' 'George' 'Ringo'

    ⊃eis/ Beatles                   ⍝    link-reduction
┌────┬────┬──────┬─────┐
│John│Paul│George│Ringo│
└────┴────┴──────┴─────┘

    ⊃,/ Beatles                     ⍝ cf join-reduction
JohnPaulGeorgeRingo

    ⊃{⍺ ⍵}/ Beatles                 ⍝ cf pair-reduction
┌────┬─────────────────────┐
│John│┌────┬──────────────┐│
│    ││Paul│┌──────┬─────┐││
│    ││    ││George│Ringo│││
│    ││    │└──────┴─────┘││
│    │└────┴──────────────┘│
└────┴─────────────────────┘

    ≢⊃eis/⎕ns¨5⍴⊂''                 ⍝ works with namespaces (JF)
5

⍝∇ eis

Back to: code

Back to: Workspaces