Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.forth Subject: Re: Yet another draw of rectangle Date: Sun, 20 Nov 2016 16:25:48 -0800 Organization: A noiseless patient Spider Lines: 25 Message-ID: <87polpbrw3.fsf@nightsong.com> References: <6755c77f-2dd0-43cc-af59-91ea3449dbbc@googlegroups.com> <14a2bc75-d574-4103-b6fa-5ff0fedfc63a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="8e075ebfe650478e78ea2fd59b90ed88"; logging-data="29305"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19qpzIJ381zI84MzjG5aejv" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:pxifbLRMUbgwTwVde82o/BNxd7Y= sha1://NAaBTTLNy4oMSUKHbEzgYsV0I= Xref: csiph.com comp.lang.forth:52781 "HAA" writes: > \ Paul's code with MOVETO > : rect ( x0 y0 x1 y1 ) > 2over 2dup MOVETO 2over SWAP ROT DRAW > 2swap DRAW DRAW DRAW ; Nice, but I think you don't want the 2DUP after the initial 2OVER : : draw ( x1 y1 -- ) ." draw " swap . . cr ; : moveto ( x y -- x y ) ." moveto " 2dup swap . . cr ; : rect ( x0 y0 x1 y1 ) 2over MOVETO 2over SWAP ROT DRAW 2swap DRAW DRAW DRAW ; : test cr clearstack 0 10 1 11 rect ; giving: test moveto 0 10 draw 1 10 draw 1 11 draw 0 11 draw 0 10 ok