POV-Ray : Newsgroups : povray.off-topic : Why is Haskell interesting? : Re: Why is Haskell interesting? Server Time
4 Sep 2024 17:23:49 EDT (-0400)
  Re: Why is Haskell interesting?  
From: Darren New
Date: 27 Feb 2010 17:19:45
Message: <4b899a81$1@news.povray.org>
Warp wrote:
> Orchid XP v8 <voi### [at] devnull> wrote:
>>    case size c of
>>      3 -> case (size (c ! 0), size (c ! 1), size (c ! 2)) of
>>             (1, 2, 3) -> (c ! 0 ! 0) + (c ! 1 ! 0) + (c ! 2 ! 0)
>>             _         -> 0
>>      _ -> 0
> 
>   I don't know why, but I got an irresistible urge to write some faux haskell
> after seeing that.
> 
>     case closed in d by
>       x -> case (open, not!, closed, yes!, 2) because
>            (1, 2, 3) -> (one, two, three) + x
>             hence    -> yes
>       hence -> no
> 
>   To me, it makes exactly as much sense. :P

I think c ! 2 is the third element of c, not unlike c[2].
switch (size(c)) {
   case 3:
     switch (size(c[0]), size(c[1]), size(c[2])) {
       case (1,2,3):
          return c[0][0] + c[1][0] + c[2][0];
       default:
          return 0;
     }
   default:
     return 0;
}

It's not *that* hard to figure out. :-)

You should look into playing around with a completely different kind of 
programming language not based on C.  Erlang or APL or something like that.

-- 
Darren New, San Diego CA, USA (PST)
   The question in today's corporate environment is not
   so much "what color is your parachute?" as it is
   "what color is your nose?"


Post a reply to this message

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