Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcsun!sunic!tut!tucos!moj
From: tuvie!brock@relay.EU.net (Inst.f.Prakt.Info 1802)
Newsgroups: comp.lang.clu
Subject: Recursive iterator in CLU?
Summary: why not recursive
Keywords: iterators
Message-ID: <730@tuvie>
Date: 30 Sep 89 17:36:50 GMT
Sender: moj@tucos.UUCP
Reply-To: vip!ulrich@relay.EU.net (Ulrich Neumerkel Inst.f.Prakt.Info 1802)
Distribution: inet
Organization: Technical University of Vienna, EDP-Center
Lines: 13
Approved: moj@cs.utu.fi
X-Posting-Number: 48

CLU's explicit concept of iterators seems at the first glance preferable
to the rather ad hoc way iterators are defined in oo -languages. (As
a method of an object, or as a friend-class.) Instead of handling
the whole state of the iterator explicitely, one can imagine the yield
statement as yust a "print" statement which will pe "piped" to the caller.
But this works for simple examples only. If you want to traverse e.g. a binary
tree you have to call within the iterator the same iterator for both left and
right subtree. In my opinion it would be more intuitive to use the "print"
methapher for all kinds of calls.

Has there anybody extended iterators in such a way?

Ulrich