home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pop
- Path: sparky!uunet!deshaw.com!jcl
- From: jcl@deshaw.com (Jonathan Laventhol)
- Subject: Re: A little Pop history
- Message-ID: <BxrLG6.2v4@deshaw.com>
- Sender: usenet@deshaw.com
- Nntp-Posting-Host: fs2
- Organization: D. E. Shaw & Co.
- References: <Bxpqvt.Lq@deshaw.com> <1e3bt3INNjc9@agate.berkeley.edu>
- Date: Sun, 15 Nov 1992 15:52:54 GMT
- Lines: 45
-
- Hi --
-
- Yep, of course, Brian was right and saw my bug. Well, here's
- the fixings.
-
- define recursivemember(item, list);
- var item, list, element;
- if list = [] then
- return(false)
- endif;
-
- for el in list do
- if el = item then
- return(true)
- elseif islist(el) and recursivemember(item, el) then
- return(true);
- endif
- endfor;
-
- return(false);
- enddefine;
-
- This illustrates another facet of the language: that boolean
- expression evaluation is defined to be ordered (left to right), as is
- argument evaluation.
-
- Sorry/thanks.
- J.
-
-
- bh@anarres.CS.Berkeley.EDU (Brian Harvey) writes:
-
- >jcl@deshaw.com (Jonathan Laventhol) writes:
- [...]
- >| for el in list do
- >| if el = item then
- >| return(true)
- >| elseif islist(el) then
- >| return(recursivemember(item, el));
- >| endif
- >| endfor;
- [...]
- >Can this be right? It looks to me as if it'll say that X isn't
- >a recursivemember of [[A B C] [X Y Z]] because it isn't in the
- >first sublist.
-