Is this what you intended of the 'me' function:
≡me 4
3
≡me 5 6
2
≡me ''
2
≡me 'f'
3
≡me 'ff'
2
≡me 'aaa' 'bbb'
3
≡me 'a' 'b'
2
On Fri, May 9, 2014 at 4:00 PM, David B. Lamkins <[email protected]> wrote:
> Here's a version that doesn't use a lambda. Instead, there's a new
> function `findl' that captures `list' from its caller (`finds').
>
> ∇z←list find key
> z←key≡¨list
> ∇
>
> ∇z←findl key
> z←(nl list) find ⊂key
> ∇
>
> ∇z←list finds keys
> z←findl¨nl keys
> ∇
>
> ∇z←me e
> z←⊂(⎕io+≡e)⊃(⊂,e) (,e) (e)
> ∇
>
> ∇z←nl l
> z←me¨(⎕io+1=≡l)⊃l (⊂l)
> ∇
>
>
> On Fri, 2014-05-09 at 12:55 -0700, David B. Lamkins wrote:
>
> [snip]
>
> > Here's an example:
> >
> > ]boxing 8
> > ll←'a' 'bc' 'def' 'foo' 'g'
> > ll
> > ┌→───────────────────┐
> > │a ┌→─┐ ┌→──┐ ┌→──┐ g│
> > │ │bc│ │def│ │foo│ │
> > │ └──┘ └───┘ └───┘ │
> > └∊───────────────────┘
> > ll finds 'a'
> > ┌───────────┐
> > │┌→────────┐│
> > ││1 0 0 0 0││
> > │└─────────┘│
> > └∊──────────┘
> > ll finds 'bc' 'foo'
> > ┌→──────────────────────┐
> > │┌→────────┐ ┌→────────┐│
> > ││0 1 0 0 0│ │0 0 0 1 0││
> > │└─────────┘ └─────────┘│
> > └∊──────────────────────┘
> > ⍝ Beware...
> > ll finds 'a' 'g'
> > ┌───────────┐
> > │┌→────────┐│
> > ││0 0 0 0 0││
> > │└─────────┘│
> > └∊──────────┘
> > ⍝ ... because:
> > 'a' 'g'
> > ┌→─┐
> > │ag│
> > └──┘
> > ll finds (,'a') (,'g')
> > ┌→──────────────────────┐
> > │┌→────────┐ ┌→────────┐│
> > ││1 0 0 0 0│ │0 0 0 0 1││
> > │└─────────┘ └─────────┘│
> > └∊──────────────────────┘
> >
>
>
>