Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!uokmax!d.cs.okstate.edu!norman From: norman@d.cs.okstate.edu (Norman Graham) Newsgroups: comp.lang.misc Subject: Re: C's sins of commission Message-ID: <1990Oct10.195202.2340@d.cs.okstate.edu> Date: 10 Oct 90 19:52:02 GMT References: <1990Oct10.101527.2247@maths.nott.ac.uk> Organization: Oklahoma State University Lines: 23 From article <1990Oct10.101527.2247@maths.nott.ac.uk>, by anw@maths.nott.ac.uk (Dr A. N. Walker): > When, as a mathematician [well, as a game player, really], > I think of a tree or a graph, I think naturally and easily of each > node as being some information plus a collection of pointers to other > nodes. I draw them that way. You may think of them differently; > but I think I should be allowed, within my chosen language, to program > them my way, and not have to pummel them into some other shape. Since you brought up the example of trees, you may want to read this Miranda definition of a 3-ary tree (just to be different). three_tree ::= Leaf num | Node int three_tree three_tree three_tree This says that a three_tree value ther a Leaf with a number or a Node with a number and 3 other three_trees. Notice that it does this without pointers to trees. Manipulation of these trees is very simple and the shape of the tree is unchanged from the corresponding pointer version. -- Norman Graham {cbosgd,rutgers}!okstate!norman The opinions expressed herein do not necessarily reflect the views of the state of Oklahoma, Oklahoma State University, OSU's Department of Computer Science, or of the writer himself.