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: Wed, 23 Nov 2016 21:59:11 -0800 Organization: A noiseless patient Spider Lines: 23 Message-ID: <87twax8llc.fsf@nightsong.com> References: <6755c77f-2dd0-43cc-af59-91ea3449dbbc@googlegroups.com> <14a2bc75-d574-4103-b6fa-5ff0fedfc63a@googlegroups.com> <87polpbrw3.fsf@nightsong.com> <87r3649c25.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="8c58a341d6f70bb50c5c5150b2e55bdc"; logging-data="2870"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/WUGkPf4iybQPa6PlLLonu" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:KAjkKBAhrjCt7GRceiVCJlhz34U= sha1:ygkfQhUQUjyPFr0XmTjlynDRlDA= Xref: csiph.com comp.lang.forth:52840 Ron Aaron writes: > For example, rephrasing the problem so that you have: > : rect \ wide high x y -- > ... ; > makes it much easier to program in Forth. Yep. Thinking Forth suggested something like that. Here's my implementation using the interface it described: : MOVETO ( x y ) swap . . ." MOVETO" cr ; : (dm) ( x caddr u -- ) 2>r . 2r> type cr ; : DOWN ( x -- ) s" DOWN" (dm) ; : UP ( x -- ) s" UP" (dm) ; : RIGHT ( x -- ) s" RIGHT" (dm) ; : LEFT ( x -- ) s" LEFT" (dm) ; : rec ( x0 y0 x1 y1 -- ) 2dup MOVETO rot - -rot - 2dup RIGHT DOWN LEFT UP ; : test cr 1 1 5 8 rec ;