How about this?
successivePairs=: 13 : '({.y),&.>y'
successivePairs
{. ,&.> ]
successivePairs 'abcd'
+--+--+--+--+
|aa|ab|ac|ad|
+--+--+--+--+
successivePairs ;.3 'abcd'
+--+--+--+--+
|aa|ab|ac|ad|
+--+--+--+--+
|bb|bc|bd| |
+--+--+--+--+
|cc|cd| | |
+--+--+--+--+
|dd| | | |
+--+--+--+--+
NB. So,
a:-.~,successivePairs ;.3 'abcd'
+--+--+--+--+--+--+--+--+--+--+
|aa|ab|ac|ad|bb|bc|bd|cc|cd|dd|
+--+--+--+--+--+--+--+--+--+--+
NB. or
a:-.~,({.,&.>]) ;.3 'abcd'
+--+--+--+--+--+--+--+--+--+--+
|aa|ab|ac|ad|bb|bc|bd|cc|cd|dd|
+--+--+--+--+--+--+--+--+--+--+
On 2/9/07, June Kim <[EMAIL PROTECTED]> wrote:
Thank you for interesting approaches, but those aren't what I was
expecting.
What I meant was "2 combination N"; compare the # of results of mine
and yours. Sorry if my description wasn't clear.
. . .
--
Devon McCormick
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm