Invisible <voi### [at] dev null> wrote:
> Let's test that hypothesis. Consider the following example:
> module Main where
> import System.IO
> import System.Random
> main = do
> x <- randomRIO (1, 100)
> main_loop x
> main_loop x = do
> putStr "Guess: "
> hFlush stdout
> l <- getLine
> let g = read l
> if g == x
> then putStrLn "Correct."
> else do
> if g < x
> then putStrLn "Too low."
> else putStrLn "Too high."
> main_loop x
That doesn't look functional at all. It looks imperative.
Throw in some functional tricks (such as infinite lists, currying and
such) and it becomes harder to figure out.
--
- Warp
Post a reply to this message
|