Article View: comp.sys.xerox
Article #402Undocumented i.s. feature
From: Mike Tanner
Date: Wed, 30 Dec 1987 16:19
Date: Wed, 30 Dec 1987 16:19
49 lines
1625 bytes
1625 bytes
I ran into this in Koto but it also happens in Lyric Interlisp. The following iterative statement -- (for i from x to y by z do (foo)) translates (i.e., DWIMIFY's) to -- (PROG (($$TEM2 y) $$TEM1 $$VAL (i x)) $$LP (COND ((AND $$TEM1 (OR (ZEROP $$TEM1) (COND ((MINUSP $$TEM1) (LESSP i y)) (T (GREATERP i y))))) (RETURN $$VAL))) (foo) $$ITERATE (SETQ i (PLUS i (SETQ $$TEM1 z))) (GO $$LP)) The problem is that it locally binds the temporary variable $$TEM2 to the value of y, as the Interlisp manual says it should, but then in the termination check it uses y. I.e., contrary to the manual's description (pg. 9.14) of "TO FORM": "Note: FORM is evaluated only once, when the i.s. is first entered, and its value bound to a temporary variable against which the i.v. is checked each iteration." If you take out the "by" -- (for i from x to y do (foo)) it DWIMIFY's correctly, i.e. -- (PROG (($$TEM1 y) $$VAL (i x)) $$LP (COND ((GREATERP i $$TEM1))))) (RETURN $$VAL))) (foo) $$ITERATE (SETQ i (PLUS i 1)) (GO $$LP)) Looks like a bug to me. -- mike tanner@tut.cis.ohio-state.edu -------
Technical Details
Message-ID:
<8712301620.AA22442@tut.cis.ohio-state.edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!think!ames!ucbcad!ucbvax!OHIO-STATE.ARPA!TANNER-M%osu-20Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!think!ames!ucbcad!ucbvax!OHIO-STATE.ARPA!TANNER-M%osu-20 From: TANNER-M%osu-20@OHIO-STATE.ARPA (Mike Tanner) Newsgroups: comp.sys.xerox Subject: Undocumented i.s. feature Message-ID: <8712301620.AA22442@tut.cis.ohio-state.edu> Date: 30 Dec 87 16:19:26 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 49