On Wed, Dec 21, 2011 at 5:43 PM, Marshall Lochbaum <[email protected]> wrote:
> A more obvious way is to use (c { b,.a) . The key is to realize that saying
> (if c then a else b) is just selection: if c is 0, we pick b, and if c is
> 1, we pick a. So we rephrase as (c { b,a), and J's implicit rank allows us
> to do (c { b,.a) for vector c, a, and b.
No. I think you mean (c {"_1 b,.a).
a=: 10 20 30
b=: 1 2 3
c=: 1 0 1
c} b,:a
10 2 30
c { b,.a
2 20
1 10
2 20
c {"_1 b,.a
10 2 30
--
Ambrus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm