Dear J Forum:
 
Thank you for the several answers to my boxing question.  What most
impressed me was the inverse of tally (#^:_1).  Since then I've found it in
the Vocabulary as the "Expand" dyad.  I'm amazed at what J can do and at how
little I've learned.
 
Sincerely,
 
Leigh
 
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Devon McCormick
Sent: Tuesday, October 31, 2006 11:52 PM
To: Programming forum
Subject: Re: [Jprogramming] Boxing according to a Pattern
 
NB. Fairly similar to Boss's solution:
   X=. i.10
   P=. 1 2 0 3 0 4
   ;P{.&.>1           NB. Build basic partition vec,
1 1 0 1 0 0 1 0 0 0   NB.  ignoring empties for now.
   $;P{.&.>1         NB. Correct length
10
   X<;.1~;P{.&.>1     NB. OK, now put empties into this
+-+---+-----+-------+
|0|1 2|3 4 5|6 7 8 9|
+-+---+-----+-------+
   (P~:0)exp X<;.1~;P{.&.>1
+-+---++-----++-------+
|0|1 2||3 4 5||6 7 8 9|
+-+---++-----++-------+
   exp
#^:_1
 
On 10/31/06, Ewart Shaw <[EMAIL PROTECTED]> wrote:
> 
> On Tue, 31 Oct 2006, R.E. Boss wrote:
> 
> >
> > #^:_1 was what I was looking for.
> >
> > Your solution can be shortened further to
> >    (i. 10) ([EMAIL PROTECTED] #^:_1 (</.~ I.)) 1 2 3 0 4
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to