--- Don Guinn <[EMAIL PROTECTED]> wrote:
> Another way is to use prefix to eliminate the upper triangular.
>
> ({:(=>.)@%])\>:i.10
> 1 0 0 0 0 0 0 0 0 0
> 1 1 0 0 0 0 0 0 0 0
> 1 0 1 0 0 0 0 0 0 0
> 1 1 0 1 0 0 0 0 0 0
> 1 0 0 0 1 0 0 0 0 0
> 1 1 1 0 0 1 0 0 0 0
> 1 0 0 0 0 0 1 0 0 0
> 1 1 0 1 0 0 0 1 0 0
> 1 0 1 0 0 0 0 0 1 0
> 1 1 0 0 1 0 0 0 0 1
>
> Still have the overhead of having to pad the short rows with zeros but
> if other processing is to be done simply do it in the tacit expression
> before returning.
>
> ([: < ] #~ {: (=>.)@% ])\>:i.10
> +-+---+---+-----+---+-------+---+-------+-----+--------+
> |1|1 2|1 3|1 2 4|1 5|1 2 3 6|1 7|1 2 4 8|1 3 9|1 2 5 10|
> +-+---+---+-----+---+-------+---+-------+-----+--------+
>
> Oleg Kobchenko wrote:
>
> > +/+/@((=<.)@% >:@i.)"0 >:i.10
> >27
Indeed, prefix is yet better idea
+/+/@((= <.)@%~ #)\>:i.10
27
+/+/@((~: *. (= <.)@%~) #)\>:i.10
17
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm