Arie Groeneveld asked:
>  Could the beheading be included [in]
>  zUr2=: (2$:1 0,~1+]) : ((>:@[$:],1,0$~1={)^:(<:{.))

I suspect I've misunderstood your question, but is this what you want?

           zUr3=: (2$:1 0,~1+]) : ([EMAIL PROTECTED](>:@[$:],1,0$~1={)@.(<:{.))
           zUr3  7
        1 0 1 1 0 1 0 1 1 0 1 1 0

This follows the pattern of your first verb:

>  zUr=: (2$:1 0,~1+]) :((>:@[$:],1,0$~1={)`([EMAIL PROTECTED])@.([>[EMAIL 
> PROTECTED])) M.

Which makes me think what you're asking is "Can I get the beheaded result
using only  ^:  (as opposed to  @.  )?".  

There's a number of ways to do this; the fundamental problem is that you
only want the behead at the end, yet your verb is recursive.    

Here's one way:

           zUr2=: (2$:1 0,~1+]) : ([EMAIL PROTECTED](>:@[$:],1,0$~1={)@.(<:{.))
           zUr4=: }.@:zUr2 f.
           
           zUr4 7
        0 1 1 0 1 0 1 1 0 1 1 0

but I find it unsatisfying:

           zUr4
        }.@:(3 : '(2 $: 1 0 ,~ 1 + ]) :([EMAIL PROTECTED](>:@[ $: ] , 1 , 0 $~ 
1 = {)@.(<: {.))
y' :(4 : 'x (2 $: 1 0 ,~ 1 + ]) :([EMAIL PROTECTED](>:@[ $: ] , 1 , 0 $~ 1 = 
{)@.(<:
{.)) y'))
           
The only other approaches that occur to me right now involve changing your
data structures to carry around extra information.  That's doable, but
unpleasant and probably not worth the performance penalty.

-Dan
-- 
View this message in context: 
http://www.nabble.com/How-to-behead-included--tf4778131s24193.html#a13669184
Sent from the J Programming mailing list archive at Nabble.com.

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

Reply via email to