Miodrag Milenkovic wrote:
> This is what I meant originally, my J is still clumsy, i would
> appreciate it if somebody made it more elegant.
...
> NB. So to get m rows where each is n?p and no two rows
> NB. are identical do
> NB. (m?p(^!._1)n) h4 p n

I've not thought this through very far yet, but I'd probably 
write an implementation which deals with two cases, defined
by whether (n?p) -: (n?p) is more likely to be 0 or
1.

For the zero case, I'd take the nub of the set of generated
rows and append sufficient to satisfy my original m.  In fact,
I'd probably generate a few extra rows and then discard them
at the end, to reduce my potential overhead here.

For the one case, I'd generate every possibility and then
deal out m rows from that list.

-- 
Raul

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to