POV-Ray : Newsgroups : povray.off-topic : My first C++ program : Re: (And in Haskell. Obviously.) Server Time
4 Nov 2024 13:46:11 EST (-0500)
  Re: (And in Haskell. Obviously.)  
From: Orchid XP v8
Date: 20 Sep 2008 06:25:05
Message: <48d4cf81$1@news.povray.org>
Nicolas Alvarez wrote:

> I understand the C++ one and the Haskell one looks like line noise.

Uh-huh, and let me guess: You already know how to read and write C++ 
fluently, but you know nothing about Haskell yet? :-P

Seriously, I am constantly baffled by statements like this. The code I 
posted contains one line which is a little cryptic (the really long one 
where I dump the stack to stdout with 1 line of code). Other than that, 
it's all really quite straightfoward.

Or are you seriously telling me that the meaning of

     if (cmd == "^") break;
     if (cmd == "+") {Add(stack); continue;}
     if (cmd == "-") {Sub(stack); continue;}
     stack.push_back(1);

is somehow clearer than

   case cmd of
     "^" -> return ()
     "+" -> binary (+) stack
     "-" -> binary (-) stack
     _   -> main_loop (1:stack)

?

To me, all that tricky slight of hand with "break" and "continue" seems 
far less clear then just directly saying exactly what you want to 
happen, as the Haskell version does.

I really can't figure out what everybody finds so confusing about 
Haskell. Is it just that it uses different syntax to other "common" 
programming languages? (E.g., no curly braces, no function call 
brackets.) Or is it something deeper?

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

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