Article View: comp.lang.misc
Article #6813Mutually recursive data structs (was Re: anyone want ...)
From: Jim Giles
Date: Fri, 23 Feb 1990 23:36
Date: Fri, 23 Feb 1990 23:36
31 lines
1456 bytes
1456 bytes
From article <1990Feb23.211123.17676@umn-cs.cs.umn.edu>, by mike@umn-cs.cs.umn.edu (Mike Haertel):
> [...]
> My one question is: How do you do mutually recursive data structures,
> rather than just diretly recursive ones?
How about the obvious:
type mutual1 is recursive
node value
mutual2 link
end type mutual1
type mutual2 is recursive
node value
mutual1 link
end type mutual2
mutual1 x = null
mutual2 y = {1,null}
...
y.link = x
x.value = 2
x.link = y
...
This list is circular. Both x and y are on the list (and nothing else
so far). The list alternates between 'mutual1' and 'mutual2' data
types. This would probably be hard to code with, but the difficulties
would all have to do with remembering the parity of the list, not
with the syntax of the language.
J. Giles
Technical Details
Message-ID:
<14253@lambda.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!think!yale!cmcl2!lanl!lambda!jlgReferences:
<1990Feb23.211123.17676@umn-cs.cs.umn.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!think!yale!cmcl2!lanl!lambda!jlg From: jlg@lambda.UUCP (Jim Giles) Newsgroups: comp.lang.misc Subject: Mutually recursive data structs (was Re: anyone want ...) Message-ID: <14253@lambda.UUCP> Date: 23 Feb 90 23:36:30 GMT References: <1990Feb23.211123.17676@umn-cs.cs.umn.edu> Distribution: usa Lines: 31