Oops, I now see that dyadic comb takes y's like i.
4, not 4, so my proposals are slightly flawed.

On Wed, 13 Aug 2008, Brian Schott wrote:

+       I propose altering the verb perm in statfns.ijs (and
+ elsewhere, if perm exists elsewhere) with the following so
+ that perm is ambivalent and the dyadic form is syntactically
+ like comb. It may also be time to replace comb with cmb but
+ I am less clear on this replacement.
+
+ chs=: 4 : ';(,/@:(([,. ]+ <:)"0 _) )&.>/ (<i.1 0),~ i.&.>x{.(-i.)y'
+ perm=: (! A.&i. ]) : chs
+
+
+ On Sun, 10 Aug 2008, R.E. Boss wrote:
+
+ + Define a
+ +   (k,n)-choice to be an ordered subset of k elements from a set of n
+ + elements and a
+ +   (k,n)-combination to be an unordered subset of k elements from a set of n
+ + elements,
+ + than the question (see (*0) below) naturally arises:
+ +  What is the index of a (k,n)-combination in the lexicographically ordered
+ + set of (k,n)-choices?
+ +
+ + Let cmb generates all (k,n)-combinations (see also (*1) below):
+ +   cmb=: [:,.^:(2>[EMAIL PROTECTED])@; [:(,.&.><@;\.)/ >:@[EMAIL PROTECTED]
+ +
+ + and chs all (k,n)-choices, see
+ + http://www.jsoftware.com/pipermail/programming/2008-August/011683.html
+ +   chs=: 4 : ';(,/@:(([,. ]+ <:)"0 _) )&.>/ (<i.1 0),~ i.&.>x{.(-i.)y'
+ +
+ + Example:
+ +
+ +    |:2 chs 5        NB. (2,5)-choices in columns
+ + 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
+ + 1 2 3 4 0 2 3 4 0 1 3 4 0 1 2 4 0 1 2 3
+ +
+ +    |:2 cmb 5        NB. (2,5)-combinations in columns
+ + 0 0 0 0 1 1 1 2 2 3
+ + 1 2 3 4 2 3 4 3 4 4
+ +
+

--

(B=) <----------my "sig"

Brian Schott
Atlanta, GA, USA
schott DOT bee are eye eh en AT gee em ae eye el DOT com
http://schott.selfip.net/~brian/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to