I agree, Roger.  However, I got the idea from the Henry Rich's Lab "An
Introductory Course in J," chapter 10, parts 2 and 3.  He did something very
elegant called "data-dependent execution," which I was hoping to apply here.
Thanks, anyway.
 
Leigh
 
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Roger Hui
Sent: Tuesday, October 24, 2006 12:55 PM
To: Programming forum
Subject: Re: [Jprogramming] Choose Operators
 
^: is not a good way to solve this problem.
B, the noun that specifies the selection, is an 
argument to the operator, not an argument to a verb,
and it is awkward to "slice and dice" an operator
argument.
 
----- Original Message -----
From: "Leigh J. Halliwell" <[EMAIL PROTECTED]>
Date: Tuesday, October 24, 2006 9:10 am
Subject: RE: [Jprogramming] Choose Operators
 
> Thank you, Roger and Cliff.  On my first question I was indeed 
> thinking of
> the monadic amend.  And Cliff's use of it for my second question 
> is nice,
> too.  But I'd still like to know how to make the identity/left 
> operator work
> one-to one, as per my second question:
> 
> "2) X0 and X1 are numeric vectors, and B is a Boolean vector.  
> They all have
> the same length.  I'd like to select from X0 where B is 0, and 
> from X1 where
> B is 1.  I try the expression: X1 [^:B X0.  But the adverb ^:B 
> wants to get
> two-dimensional, i.e., to apply each B to every pair of X1 and X2. 
> How can
> I make J to apply the adverb one-to-one with the arguments?"
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to