Many thanks to both Georg and Lemmih.  Actually, I had considered laziness,
but I didn't pursue it enough.  I tried one version of runNReps in which I
passed (f x) as an additional arg; when that didn't work, a little thought
convinced me that laziness was doing me in.  I also tried another approach,
which was to "use" the function evaluation, but that didn't work either
(note: I know (f x) can not be the empty list for values of x I'm interested
in, but I don't think Haskell does, unless it's *really* smart :-) :

> runNReps :: (Int -> [a]) -> Int -> Int -> IO ()
> runNReps f x todo
>             | todo > 0 = do let junk = (f x)
>                                     if null junk then return (()) else
runNReps f x (todo - 1)
>             | otherwise = return (())

Ideas?

Again, many thanks,

 -- Bill Wood
    [EMAIL PROTECTED]

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to