Talk:Probabilistic choice: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎J solution: another way of counting)
(I don't think that works right.)
Line 11: Line 11:


:--[[User:Gaaijz|Gaaijz]] 18:41, 26 December 2008 (UTC)
:--[[User:Gaaijz|Gaaijz]] 18:41, 26 December 2008 (UTC)

:The problem I see with this is that it operates on the assumption that the actual proportions will fit the target proportions. This is to be tested, so cannot be assumed. The flaw is most clear when very small runs occur, in which cases the actual proportions are usually not in the same order as the targets. In such cases the code proposed above will pair proportions inaccurately. Nevertheless, I do appreciate being reminded of reflexive keyed-copy. --[[User:TBH|TBH]] 19:18, 27 December 2008 (UTC)

Revision as of 19:18, 27 December 2008

J solution

Well done, TBH.

--DanBron 22:44, 24 December 2008 (UTC)

Thanks, Dan. As I'm sure you recognized, the local definitions are simply for improving readability. In particular, the one for partitions (prtn) exists only to document and emphasize the partition-set that is the left argument to Interval Index. Omitting that name would still keep things simple and readable: da=. (+/\pt) I. ?y # 0
--TBH 18:55, 25 December 2008 (UTC)

TBH I don't know if it's worth it, but another possib. for counting is: pa =. \:~ y%~ #/.~ da

--Gaaijz 18:41, 26 December 2008 (UTC)
The problem I see with this is that it operates on the assumption that the actual proportions will fit the target proportions. This is to be tested, so cannot be assumed. The flaw is most clear when very small runs occur, in which cases the actual proportions are usually not in the same order as the targets. In such cases the code proposed above will pair proportions inaccurately. Nevertheless, I do appreciate being reminded of reflexive keyed-copy. --TBH 19:18, 27 December 2008 (UTC)