I think it's a hard problem to do nice and tacitly, since H. is a conjunction.

You could massage it into being an explicit adverb taking p as noun, q
for left argument, and i.3 for right one:

A =: 1 : (':';'(y!m)*x H. (1+m-y)1')
res =: q (p A)"1 0 i.3

The rest of the operations, I would spontaneously put into an array, using:

({. , [: %: 2 * {: - 2 ! {.)@(}. % {.) res
45 35.4965

Jan-Pieter

2014-07-10 14:10 GMT+02:00 'Bo Jacoby' via Programming
<[email protected]>:
> The above message was sent but apparently not recieved. So I resend it.
>
>
>
> Den 22:33 tirsdag den 8. juli 2014 skrev Bo Jacoby <[email protected]>:
>
>
>>
>>
>>Dear J'ers.
>>
>>
>>This note on wikipedia contains some J-code.
>>
>>
>>https://en.wikipedia.org/wiki/Talk:Mark_and_recapture#Statistical_treatment
>>
>>
>>I would like your comments and improvements.
>>
>>
>>I am specially unhappy with this code:
>>
>>
>>'K n k'=.11 10 4 p=.K+n-k q=.1+(K,n)-k A0=.(0!p)*q H.(1+p-0)1 A1=.(1!p)*q 
>>H.(1+p-1)1 A2=.(2!p)*q H.(1+p-2)1 s1=.A1%A0 s2=.A2%A0 s1,%:2*s2-2!s1
> 45 35.4965
>>
>>The assignment to (A0,A1,A2) should be done in one line, and not in three 
>>lines.
>>
>>Thanks!
>>Bo
>>
>>
>>
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to