POV-Ray : Newsgroups : povray.off-topic : My hypothesis : Re: My hypothesis Server Time
29 Jul 2024 14:26:58 EDT (-0400)
  Re: My hypothesis  
From: Alain
Date: 5 Sep 2011 12:46:40
Message: <4e64fcf0@news.povray.org>

> On 02/09/2011 04:36 PM, Invisible wrote:
>
>> Hypothesis: The Haskell language isn't hard. Typical Haskell *programs*
>> are hard.
>
> 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
>
> This is written in Haskell. However, I would expect that anybody
> familiar with computer programming should be able to figure out what
> this does, without knowing anything at all about Haskell. I mean, you
> couldn't /write/ this code, but you can /read/ it and figure out what it
> does. Which would seem to strongly contradict "Haskell is
> incomprehensible".
>
> ...or maybe I'm just delusional from having spent too long with Haskell?
> Maybe it only looks readable to my eyes. What do we say, people?

I think it's the first time I see actual Haskell code, and I can read 
that one easily.
But,then, it's a prety trivial example.


Alain


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.