> From: Brian Schott
> Yes, I was able to use your answer to craft an answer.
> Please check this out.
>
> R =: ccog (/: {:"1)@((0 1+"1 (4&$.)) ,. 5&$.)@:$.@(%/) rhub
>
> (<"0 (1&{)"1 R),.(<"1 (3j1&":)@{:"1 R)(<"1 ({."1,....@#)R)}(a:$~3,~#
> ) R
Another variant:
load 'numeric'
R=: ccog (/: {:"1)@((4$.$.) ,. 0.01&round@,)@(%/) rhub
(1{"1 R),.({:"1 R) (([: <"1 i...@# ,. {."1)R)} (_ $~ #&>) R;ccog
I tried to use the gerund form of amend but the monadic form doesn't seem to be
valid:
(({:"1)`([: <"1 i...@# ,. {."1)`(_ $~ [: #&> ;&ccog)) } R
|length error
| (({:"1)`([:<"1 i...@#,.{."1)`(_$~[:#&>;&ccog))}R
And the dyadic form seems a bit clumsy for this case:
'dummy' (({:"1...@])`([: <"1 i...@#@] ,. {."1...@])`(_ $~ [: #&> ;&c...@])) } R
Could make the left arg more useful if desired:
ccog (({:"1...@])`([: <"1 i...@#@] ,. {."1...@])`(_ $~ [: #&> ;~)) } R
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm