Here's a tacit variation, where we filter
scalars before making pairs:

   (0&, #: ,@(</~)@i. # [EMAIL PROTECTED]:) each 3 4 5
+---+---+---+
|0 1|0 1|0 1|
|0 2|0 2|0 2|
|1 2|0 3|0 3|
|   |1 2|0 4|
|   |1 3|1 2|
|   |2 3|1 3|
|   |   |1 4|
|   |   |2 3|
|   |   |2 4|
|   |   |3 4|
+---+---+---+




> From: Ken Chakahwata <[EMAIL PROTECTED]>
> 
> Oops, finger happy!
> 
> pair8 =: 3 : 0
> t =. (0,y)#: i. (*<:) y
> t =. (</"1 t)#t
> 
> ken
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Roger Hui
> Sent: 10 November 2008 21:37
> To: Programming forum
> Subject: Re: [Jprogramming] pairs
> 
> Actually, the "amend" idea does not use boxing.
> 
> pair6a=: 3 : 0
> t=. ((2!y),2)$0 1+0
> t=. (1,.-.(-i.)y-2) (}:+/\(-i.)y-1)}t
> +/\t
> )
> 
> However, the idea of generating all possible pairs and
> then selecting the suitable ones is good.  Variations on 
> that theme:
> 
> pair7 =: (> pair7a=: (> 
> 
> 
> ----- Original Message -----
> From: Andrew Nikitin 
> Date: Monday, November 10, 2008 11:26
> Subject: [Jprogramming] pairs
> To: J programming 
> 
> > 
> > I haven't seen a flat version, that is the one that does not use 
> > boxing. If I just missed it, sorry for duplication. If there 
> > wasn't one then here it is. 
> >  
> >    (> ----------------------------------------------------------------------
> 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

Reply via email to