Hi,

some APLs have a combination of assignment with a function, for example :

      a←⍳5
      a+←1
      a
2 3 4 5 6

This can be combined with index to good effect, for example counting
character occurrences in a text vector :
      ,bkt←0/⍨1+≢lc
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
      bkt[lc⍳'short test']+←1
      bkt,[.5]lc,' '
0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 2 3 0 0 0 0 0 0 1
a b c d e f g h i j k l m n o p q r s t u v w x y z

Is there something equivalent in J ?
All I have come up with is the classical construct using the table operator
:

   lc,:1": +/'short test'=/lc

abcdefghijklmnopqrstuvwxyz

00001001000000100123000000
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to