POV-Ray : Newsgroups : povray.off-topic : Binary trees, branches and leaves : Re: Binary trees, branches and leaves Server Time
4 Sep 2024 09:15:58 EDT (-0400)
  Re: Binary trees, branches and leaves  
From: Invisible
Date: 4 Mar 2010 11:57:13
Message: <4b8fe669$1@news.povray.org>
Darren New wrote:

> I realized why I thought trees in an OO language have child nodes with 
> null branches - It's OO. You have pointers to things. In Haskell, it's 
> expected that when you add a new leaf down at the bottom of the tree, 
> the root node changes. In OO, you don't want to have to reassign all 
> variables holding pointers to the root when you add a leaf. And that 
> applies recursively as well. Even balancing a tree, you tend to rotate 
> the child pointers rather than reassign the parent pointer, per se.

More succinctly: In OO, trees are usually mutable. In Haskell, trees are 
usually immutable.

> So that's at least part of it.

A bigger part of it is that, while essentially Haskell has pointers, 
null pointers are explicitly prohibited.


Post a reply to this message

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