
On 16/01/2009 01:28, "Luke Palmer"
Compile-time constants could be handled by simple top-level bindings. This technique is specifically for the case you are after:
mcSimulate :: Double -> Double -> Word64 -> [Double] mcSimulate startStock endTime seedForSeed = go seedForSeed where go = fst expiryStock : go newSeedForSeed where expiryStock = iterate evolveUnderlying (startStock, ranq1Init seedForSeed) !! truncate (endTime/timeStep) newSeedForSeed = seedForSeed + 246524
See what's going on there?
I don't know about that nested where. In Real Life I would probably use a let instead for expiryStock and newSeedForSeed.
Luke
Ahh, I get it now, that¹s pretty neat - go¹ is only updating the seedForSeed and the expiryStock, the inner where¹ clause keeps everything else constant each time it is called.
Thanks again! Phil.