Essays/Covert Representation

From J Wiki
Jump to: navigation, search

An array is covert if its display is empty, that is, if it has a 0 in the non-trailing elements of its shape.

   i. 0 7      NB. covert
   i. 4 3 0 2  NB. covert
   i. 2 0      NB. non-covert


   i. 0        NB. non-covert

It is possible to represent a noun covertly:

   f=: i.@(0&,)@(a.&i.)@(3 : '5!:5 <''y''')
   g=: ".@({&a.)@(}.@$)

   x=: 2 4$ ;:'any noun onomatopoeia eleemosynary synecdoche'

   f x
   $f x
0 50 32 52 36 60 59 46 95 49 32 39 32 97 110 121 32 110 111 117 110 32 111 110 ...
   g f x
┌──────────┬────┬────────────┬────────────┐
│any       │noun│onomatopoeia│eleemosynary│
├──────────┼────┼────────────┼────────────┤
│synecdoche│any │noun        │onomatopoeia│
└──────────┴────┴────────────┴────────────┘
   x -: g f x
1



Contributed by Roger Hui. An earlier version of the text previously appeared in the J Forum on 2007-08-02.