Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun-barr!texsun!pollux!ti-csl!m2!gateley From: gateley@m2.csc.ti.com (John Gateley) Newsgroups: comp.lang.modula2 Subject: Re: Recursive data types Message-ID: <77390@ti-csl.csc.ti.com> Date: 11 May 89 15:25:22 GMT References: <5734@cs.Buffalo.EDU: <1046@gmdzi.UUCP> <11188@polyslo.CalPoly.EDU> Sender: news@ti-csl.csc.ti.com Reply-To: gateley@m2.UUCP (John Gateley) Organization: TI Computer Science Center, Dallas Lines: 25 In article <11188@polyslo.CalPoly.EDU> mlind@polyslo.CalPoly.EDU (Mark William Lind I) writes: >This is dynamic memory allocation... but this is not a RECURSIVE >data type. Personally, I don't see what the use of a recursive >data structure is. Dynamic memory allocation is of obvious >worth (no pun intended), but I don't see what the hell you would >do with a recursive boolean expression?....... huh? Hello Mark, This is not a recursive boolean expression, but it is a recursive data structure based on a recursive datatype. Have a datatype: infinite-list. There are three operations: head, tail, and cons (add an element). Now, we can define the Fibonacci numbers as an infinite list, the first two elements are 1, each succeeding element is the sum of the two previous elements. Even though the list is infinite, the program will actually only use a finite (but arbitrarily large) portion of it. I think this might be a recursive data type. Disclaimer: this idea comes from Lisp/Scheme streams. It doesn't have much to do with Modula2. John gateley@tilde.csc.ti.com