Exercise 16 Index   <<   >>


 

Write a 1-line model for inverted-table index-of.


   t                         ⍪¨t
┌─────┬──────┬─────┐      ┌─────┬─┬─────┐
│Carlo│FDSRMC│ 0  1│      │Carlo│F│ 0  1│
│John │      │ 2  3│      │John │D│ 2  3│
│John │      │ 4  5│      │John │S│ 4  5│
│Diane│      │ 6  7│      │Diane│R│ 6  7│
│Roger│      │ 8  9│      │Roger│M│ 8  9│
│Lisa │      │10 11│      │Lisa │C│10 11│
└─────┴──────┴─────┘      └─────┴─┴─────┘

   t itix t
0 1 2 3 4 5

   t itix ⊖¨t
5 4 3 2 1 0

   t itix a←(2 5⍴'John ') ('DS') (2 2⍴2 3 444 555)
1 6




























   itix ← {(⍉↑⍺⍳¨⍺)⍳(⍉↑⍺⍳¨⍵)}


   t (8⌶) t
0 1 2 3 4 5

   t (8⌶) ⊖¨t
5 4 3 2 1 0

   t (8⌶) a
1 6