On 16/01/2009 01:28, "Luke Palmer" <lrpalmer@gmail.com> wrote:
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.