Summary: prefixes of infixes is twice as good in all respects as is my use of cut. Improve my vertexes verb?
NB. Cut works. 0,.3 1 1$4 8 12 0 4 0 8 0 12 (0,.3 1 1$4 8 12)];.0 ] 64}.a. @ABC @ABCDEFG @ABCDEFGHIJK (v0-:v1) a=: i.1000 1 v0 NB. append prefixes of length 4 infixes <&,\@(_4&(,\)) v1 NB. cut <;.0~ vertexes vertexes 1 0 2 |: 0 ,: [: ,. 4 * [: >:@i. 4 <.@%~ # 100 ts 'v0 a' 0.0009046 1.44013e6 100 ts 'v1 a' 0.00237905 2.74854e6 > Date: Sun, 25 Sep 2011 19:44:09 +0100 > From: David Vaughan <[email protected]> > Subject: [Jprogramming] Infixes > To: Programming forum <[email protected]> > Message-ID: <[email protected]> > Content-Type: text/plain; charset=us-ascii > > I'm trying to apply a verb to infixes of length 4 but I want it to be > cumulative. i.e. in the list: > > 3 5 7 9 13 17 21 25 31 37 43 49 > > I want: > > verb 3 5 7 9 > verb 3 5 7 9 13 17 21 25 > verb 3 5 7 9 13 17 21 25 31 37 43 49 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
