⍝ Locations of item ⍺ in ⍵:

    1 in 3 1 4 1 5                              ⍝ vector of paths
┌─┬─┐
│2│4│
└─┴─┘

    'o' in 'hello' 'world'                      ⍝ locations of 'o' characters
┌───┬───┐
│1 5│2 2│
└───┴───┘

    'o'{'⌽' @(⍺ in ⍵)⊢⍵} 'hello' 'world'        ⍝ substitution
┌─────┬─────┐
│hell⌽│w⌽rld│
└─────┴─────┘

    'o'in ⍪'hello' 'world'                      ⍝ paths in matrix ⍵
┌───────┬───────┐
│┌───┬─┐│┌───┬─┐│
││1 1│5│││2 1│2││
│└───┴─┘│└───┴─┘│
└───────┴───────┘

    avg←(sum←+⌿)÷≢                              ⍝ functions for sum and average

    ⎕cr'avg'                                    ⍝ character rep.
┌──┬─┬─┐
│+⌿│÷│≢│
└──┴─┴─┘

    'sum'{(⊂⍺)@((⎕CR ⍺)in ⎕CR ⍵)⊢⎕CR ⍵}'avg'    ⍝ name instead of value
┌───┬─┬─┐
│sum│÷│≢│
└───┴─┴─┘

    'hello'in ⊂⊂⊂'hello'                        ⍝ nested scalars
┌────┐
│┌┬┬┐│
││││││
│└┴┴┘│
└────┘
    display 0 in ⍳0                             ⍝ finds prototypical item
┌⊖────┐
│ ┌→┐ │
│ │0│ │
│ └~┘ │
└∊────┘

    0 in (1 1⍴⊂)⍣4 ⊢0                           ⍝ nested matrices
┌─────────────────┐
│┌───┬───┬───┬───┐│
││1 1│1 1│1 1│1 1││
│└───┴───┴───┴───┘│
└─────────────────┘

⍝∇ in display

Back to: code

Back to: Workspaces