POV-Ray : Newsgroups : povray.off-topic : My hypothesis : Re: My hypothesis Server Time
29 Jul 2024 14:23:01 EDT (-0400)
  Re: My hypothesis  
From: Warp
Date: 5 Sep 2011 14:45:05
Message: <4e6518b1@news.povray.org>
Orchid XP v8 <voi### [at] devnull> wrote:
>    insert :: Ord x => x -> MinHeap x -> MinHeap x
>    insert x' (Leaf        ) = Node x' Leaf Leaf
>    insert x' (Node x h0 h1) = Node (min x x') (insert (max x x') h1) h0

  This is a good example of where it becomes confusing. Even after
studying it for a few minutes I can't really figure out what is it
that it's doing. (Or, more precisely *how* it's doing it. The 'insert'
name makes it obvious what is it that it does, but the code doesn't make
it at all clear how.)

  Maybe the problem is that in an imperative language the different
situations would be more explicitly expressed with an 'if...then...else'
block. Here it's not clear at all what is it that the code is expressing.

  Of course it doesn't help that the syntax is quite uncommon, and the
meaning of the different operators isn't clear. (For instance, it's unclear
whether the ' is some kind of operator, and if it is, what exactly its role
is. If it isn't an operator but somehow just part of the variable name, it's
highly unusual.)

  The lack of separators is also confusing to someone who is accustomed to
programming languages that use separators.

-- 
                                                          - Warp


Post a reply to this message

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