Sorry, I didn't read your output carefully so I mistinterpreted your question 
(thought you wanted to swap posn 0 with posn x).

-Dan



Please excuse typos; composed on a handheld device.

-----Original Message-----
From: "Dan Bron" <[email protected]>
Date: Fri, 29 Apr 2011 12:07:53 
To: J Programming<[email protected]>
Reply-To: [email protected]
Subject: Re: [Jprogramming] A permutation of i.y

foo =: <@(0,[) C. i.@]

(Untested)

-Dan



Please excuse typos; composed on a handheld device.

-----Original Message-----
From: Ian Clark <[email protected]>
Sender: [email protected]
Date: Fri, 29 Apr 2011 13:03:55 
To: Programming forum<[email protected]>
Reply-To: Programming forum <[email protected]>
Subject: [Jprogramming] A permutation of i.y

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

Reply via email to