June Kim wrote:
> Thank you for the solution but it doesn't seem to work right.
> 
>    none_and_spare_case=:0 10 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 NB. 30

Oops, my mistake.

I guess I need to do this the hard way:
frame=: [:(*.11>+/\)@|[EMAIL PROTECTED](1((1:`([EMAIL PROTECTED]:)@.([EMAIL 
PROTECTED])@],{:@[),.])/@,.])@|.

That should be unwrapped onto one line, and replaces my
erroneous concept of a frame.  It should also be run through
J's linear rep to introduce some needed whitespace -- making
it more readable.

For that matter, it's complex enough that I should probably convert
it to an explicit definition.  An explicit definition can make better
use of vertical whitespace and which I think tends to make this sort
of thing more readable.

Or, I should break that definition out into several words.  Perhaps
four pieces: the part that sets up for the main reduce operation,
the reduce operation itself (without the reduce operator), the part
that post-processes that result, and finally the "frame" verb which
combines these pieces.  Something like:

F1=: 1 ,. |.
F2=: (1:`(10 = [EMAIL PROTECTED]:)@.([EMAIL PROTECTED])@] , {:@[) ,. ]
F3=: (*. (11 > +/\))@|[EMAIL PROTECTED]
frame=: [: F3 [: F2/ F1

The heart of this operation, F2, assembles a state history
where the top row is the bit that marks the beginning of a
frame, and the bottom row is the number of pins which were
knocked down in that set (which is needed in determining
whether the next ball begins a new frame).

What I think I really want for this kind of thing is an 
operator which has some of the characteristics of a 
tesselation like dyadic \ or ;. and some of the characteristics
of an iteration operator like /

Maybe if I thought a bit more, something obvious would occur to
me about this.

Thanks,

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

Reply via email to