> Van: Peter B. Kessler
> Verzonden: maandag 30 juli 2012 22:12
(...)
> 
> This doesn't address the case where both inputs have 1's in the same column
> 
>          ]C=:2 5 $ 1 0 0 1 0 0 1 0 1 0
>       1 0 0 1 0
>       0 1 0 1 0
>          (>./-<./)+/\+/1 _1 *C
>       1
> 
> The original statement of the problem doesn't say what to do with 
> simultaneous 1's, but I would think they fail the "alternating"
> description.

IMO this case is not included in the specs of the problem.
Or one could even think it qualifies.

> I am a total newb when it comes to J programming, though I did some APL 
> programming in the early 1970's.  I find that what's
missing
> from this example (and lots of other examples of J programs) is a statement 
> of why it is written the way it is. 

I am not in the education business, others are better in that area, unless 
non-trivial questions arise, since I assume people (of
our age) with interest in J very well know how to teach themselves.

> For example, I love the use of "+/\" in the above to propagate the state of 
> the match.
> (Though, I worry a little about the efficiency of it, if prefix really 
> reapplies the verb to each of the possible prefixes,
especially as the
> inputs get long.)  

Compare performances of (+/\) with (plus/\) where (plus=.+ ) .
As a newbie, performance should not be one of the first things to worry about.


R.E. Boss



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

Reply via email to