
14 Aug
2008
14 Aug
'08
7:57 a.m.
On Thu, Aug 14, 2008 at 12:15 PM, Patrick Perry
Actually, a much better solution is:
variant :: Int -> Gen a -> Gen a variant v (Gen m) = Gen (\n r -> m n (rands r v)) where rands r0 0 = r0 rands r0 n = let (r1,r2) = split r0 (n',s) = n `quotRem` 2 in case s of 0 -> rands r1 n' _ -> rands r2 n'
It's not really clear to me how this works. Could you please explain? Cheers, Johan