POV-Ray : Newsgroups : povray.off-topic : An explanation of what next_permutation does : Re: An explanation of what next_permutation does Server Time
4 Sep 2024 23:23:45 EDT (-0400)
  Re: An explanation of what next_permutation does  
From: Warp
Date: 5 Dec 2009 12:12:16
Message: <4b1a9470@news.povray.org>
Orchid XP v8 <voi### [at] devnull> wrote:
> Warp wrote:

> >   Because it's exactly as (or even more) obfuscated as your hated C, and
> > it seems to be equally easy to make something "crash" by mistake.

> If you make a typo in a Haskell program, the program stops and says 
> "error: you tried to access the first element of an empty list". If you 
> make a typo in a C program, the program stops and says "error: 
> segmantation fault".

  And?

> The former is easier to debug [although, admittedly, it gives you 
> absolutely no indication of *where* the program crashed], while the 
> latter is no fun at all. Also, the former is an *exception*. You can 
> catch exceptions and handle them if you want. As far as I'm aware, you 
> cannot catch segfaults.

  Actually you can catch exceptions in most systems, and you can resolve
the exact location of the crash using a debugger.

> >   Also you should understand that the Haskell line might not be obfuscated
> > to *you* because you know how to read it, but it's quite obfuscated to
> > others who don't understand it. The same works for C as well. Thus you
> > really don't prove anything by saying "that piece of C(++) is really
> > obfuscated, I don't understand it, here's how I would write it in Haskell"
> > and proceed to present a program which is at least as obfuscated.

> Performing multiple steps all at once in a small blob of symbols? Sounds 
> fairly non-trivial to me.

  Haskell is fairly (in)famous for its one-liners which do tons of things.

> By contrast, the Haskell version doesn't use 
> any remotely advanced features of Haskell, just a few case expressions 
> with some basic pattern matching. No monads, no typeclasses, no 
> existential types, nothing. Just plain ordinary pattern matching.

  Because you wrote it so. The C++ version could also have been written to
be as verbose and straightforward as possible. It's not like you *have* to
write dense code.

> For me, the question is not how obscure it looks, but how difficult it 
> is to explain it.

  Many Haskell one-liners would probably take entire books to explain.

-- 
                                                          - Warp


Post a reply to this message

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