> From: zaxis <z_a...@163.com> > > So if the local variable can be changed, then we can use loop, etc. same as > imperative languages. For example, for (i=0; i<100; i++) where `i` is a > local variable in function. >
In addition to John Millikin's suggestion, you can also do: map f [0..99] where f :: Int -> a; f = ... or mapM f [0..99] where f :: Int -> m a; f = ... for monadic actions. Here "f" is the body of the loop. The loop bodies must be completely independent, but this is a very useful technique. Cheers, John _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe