Path: news.daimi.aau.dk!news.uni-c.dk!sunic!ugle.unit.no!nac.no!ifi.uio.no!nntp!alfh From: alfh@byleist.ifi.uio.no (Alf-Ivar Holm) Newsgroups: comp.lang.beta Subject: Re: Recursive, double INNER Date: 14 Feb 1995 12:29:44 GMT Organization: Dept. of Informatics, University of Oslo, Norway Lines: 51 Message-ID: References: <3hntel$17j@belfort.daimi.aau.dk> NNTP-Posting-Host: byleist.ifi.uio.no In-reply-to: olevi@daimi.aau.dk's message of 13 Feb 1995 15:21:57 GMT CC: In article <3hntel$17j@belfort.daimi.aau.dk> olevi@daimi.aau.dk (Ole Villumsen) writes: > I know (Jens Cornelius Olsen) has already followed up to this question. > I think I have a different solution that I personally like better. > I avoid the use of pattern references (##'s). Instead I use another block > level: > > forAllThings: > (# before:< ... > after:< ... > recursiveForAll:< > (# do before; ... &recursiveForAll; ... after; #); > do &recursiveForAll; > #); > > forAllDingbats: forAllThings > (# before::< (# ... #); > after::< (# ... #); > #); > > Does this solve your problem? It does solve the problem, and it looks prettier, but it may introduce another complication because of the new block level: If there are some variables in forAllThings that is accessible to before and after, let us say some "current" pointer that is set before "before". This variable is updated in recursiveForAll, but is declared in forAllThings, to make it accessible to before and after. Since this is a global variable to recursiveForAll, it have to be reset before the "after" call, since some recursive call to recursiveForAll have changed current. Something like: forAllThings: (# before:< ... after:< ... current: someObject; recursiveForAll: (# do ... foo[] -> current[]; before; ... &recursiveForAll; ... foo[] -> current[]; after; #); do &recursiveForAll; #); It does solve the problem, but you have to be careful! Affi