Nice one, Henry. And thanks for the idea to use C. , Dan -- it almost does what I want but it floats DOWN the LAST element instead of floating up the first... (but I can use it with minor adaptation)
fi=: [ C.^:_1 [: i. ] 3 fi 9 0 1 2 8 3 4 5 6 7 On Fri, Apr 29, 2011 at 1:22 PM, Henry Rich <[email protected]> wrote: > 3 /:@(0} i.) 9 > 1 2 0 3 4 5 6 7 8 > > Henry Rich > > On 4/29/2011 8:03 AM, Ian Clark wrote: >> My brain's a mess this morning... >> >> Let foo be a dyadic verb which simply returns i.y with the zero >> floated up to position x . >> (Forget the cases of x<1 and x>y) >> >> foo=: 4 : '(1|.i.x) , (x}.i.y)' >> 3 foo 9 >> 1 2 0 3 4 5 6 7 8 >> >> That's a distressing way of doing it, but it's the best I can manage. >> There's got to be a neater solution. Using # maybe? >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
