Ok, I think I've gotten over my inability to look at this problem right:

p=:4 3$;:'p0 p0 p0 p1 p1 p1 p0 p1 p0 p1 p0 p0'
s=: ;:'s0 s1 s2 s3'
t=: ;:'t0 t1 t2'

splayleft=:2 :0
  L=.,m["0/n
  R=.,m]"0/n
  (L/:R) ((i.#y) <@,"0 /:/:y/:R)} a: $~,~#y
)

splayrght=:2 :'(,m ]"0/n) ((i.#y) <@,"0 /:/:y)} a: $~,~#y'

Example use:
   s splayleft t ,p
   s splayrght t ,p

I could probably rephrase that to better re-use common subexpressions,
but rather than think about that, I want to just correct my earlier mistake.

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

Reply via email to