Phrases/Verb Table

From J Wiki
Jump to: navigation, search

Verb Table

vta is Verb Table Adverb, a variation of function table, which shows the applied verb

   over=: ({. ; }.)@":@,
   vby =: 1 : '(5!:5<''u'')&;@,.@[ ,. ]'
   vta =: 1 : '[ u vby ] over u/'

   2 0 2 1  * vta  3 1 4 2
+-+-------+
|*|3 1 4 2|
+-+-------+
|2|6 2 8 4|
|0|0 0 0 0|
|2|6 2 8 4|
|1|3 1 4 2|
+-+-------+
   f=. (+ -)"0
   2 0 2 1  f vta  3 1 4 2
+-+-----------+
|f| 3  1  4  2|
+-+-----------+
|2|_1  1 _2  0|
|0|_3 _1 _4 _2|
|2|_1  1 _2  0|
|1|_2  0 _3 _1|
+-+-----------+

Fixed New Table

The following definition is similar to J 601 obeta does not use local variables, thus allows functions such as f.

table=: 1 : 0~
:
(((#~LF-.@e.])5!:5<'u');,.y),.({.;}.)":x,y u/x
)


Contributed by Oleg Kobchenko


The updated table adverb will be in the next beta. Thanks to Rob Hodgkinson for the idea for the obeta, and Oleg for the same idea, and for the fix to the obeta. -- Chris Burke <<DateTime(2006-06-19T03:22:52Z)>>