(*./"1 a<10) # a

maybe?


On Wed, Feb 19, 2014 at 5:40 PM, Joe Bogner <[email protected]> wrote:

> This is an easy one, but it's escaping me after searching and trying
> several things
>
> How can I mimic this with a 2d array? I want to only return the rows the
> match a boolean expression
>
> Works
>    a=: i. 10
>   (a < 5) # a
> 0 1 2 3 4
>
>
> Does not work the way I want...
>
>  a=:i. 5 10
>    a
>  0  1  2  3  4  5  6  7  8  9
> 10 11 12 13 14 15 16 17 18 19
> 20 21 22 23 24 25 26 27 28 29
> 30 31 32 33 34 35 36 37 38 39
> 40 41 42 43 44 45 46 47 48 49
>
> (a < 10)
> 1 1 1 1 1 1 1 1 1 1
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
>
>    (a < 10) # a
> |length error
>
>
> This kind of does it:
>
> (a < 10) #"1 a
> 0 1 2 3 4 5 6 7 8 9
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> ----------------------------------------------------------------------
> 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