Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #52806

Re: Yet another draw of rectangle

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject Re: Yet another draw of rectangle
Date 2016-11-22 00:02 -0800
Organization A noiseless patient Spider
Message-ID <87r3649c25.fsf@nightsong.com> (permalink)
References (3 earlier) <o0rv3a$1avt$1@gioia.aioe.org> <14a2bc75-d574-4103-b6fa-5ff0fedfc63a@googlegroups.com> <o0tcfn$1mju$1@gioia.aioe.org> <87polpbrw3.fsf@nightsong.com> <o0tsml$7cu$1@gioia.aioe.org>

Show all headers | View raw


"HAA" <someone@microsoft.com> writes:
> MOVETO ( x y -- ) is a general-purpose function in the graphics
> package and requires the 2DUP here.  I think you have hit on the
> definitive Forth definition for RECT.  My original was 14
> instructions, yours would make it 11.

Heh, I'm sure others have done it better.  And the LINE version is still
a pretty annoying challenge.  I wrote a "brute force" version with the
idea of refactoring it for fewer operations after writing it; but
getting it working was time consuming and tiring enough that I put it
aside after it worked:

    : 4dup 2over 2over  ;

    : LINE ( x0 y0 x1 y1 -- ) 2>r swap . . 2r> swap . . cr ;

    \ & in stack comment means duplicate the input parameters
    : r1 ( x0 y0 x1 y1 -- & x0 y0 x1 y0 ) 4dup drop over ;

    : r2 ( x0 y0 x1 y1 -- &  x1 y0 x1 y1 )
        4dup  >r -rot nip over r> ;

    : r3 ( x0 y0 x1 y1 -- & x1 y1 x1 y0 )
        4dup 2swap drop over ;

    : r4 ( x0 y0 x1 y1 -- x0 y1 x0 y0 )
        nip ( x0 y0 y1 )
        >r over r> ( x0 y0 x0 y1 )
        -rot swap ;

    : rect r1 LINE r2 LINE r3 LINE r4 LINE ;

    : test cr clearstack 0 10 1 11 rect ;

Is this really the language we want to entice schoolkids into
programming with?!  :)

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Yet another draw of rectangle humptydumpty <ouatubi@gmail.com> - 2016-11-19 13:34 -0800
  Re: Yet another draw of rectangle "Robert L." <No_spamming@noWhere_7073.org> - 2016-11-20 00:53 +0000
  Re: Yet another draw of rectangle "HAA" <someone@microsoft.com> - 2016-11-20 14:46 +1100
    Re: Yet another draw of rectangle Paul Rubin <no.email@nospam.invalid> - 2016-11-19 20:01 -0800
      Re: Yet another draw of rectangle "HAA" <someone@microsoft.com> - 2016-11-20 20:10 +1100
      Re: Yet another draw of rectangle Paul Rubin <no.email@nospam.invalid> - 2016-11-20 01:18 -0800
        Re: Yet another draw of rectangle humptydumpty <ouatubi@gmail.com> - 2016-11-20 01:36 -0800
          Re: Yet another draw of rectangle Paul Rubin <no.email@nospam.invalid> - 2016-11-20 02:16 -0800
            Re: Yet another draw of rectangle humptydumpty <ouatubi@gmail.com> - 2016-11-20 02:36 -0800
            Re: Yet another draw of rectangle Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2016-11-20 07:48 -0500
              Re: Yet another draw of rectangle rickman <gnuarm@gmail.com> - 2016-11-22 23:36 -0500
    Re: Yet another draw of rectangle humptydumpty <ouatubi@gmail.com> - 2016-11-20 02:03 -0800
      Re: Yet another draw of rectangle "HAA" <someone@microsoft.com> - 2016-11-20 21:49 +1100
        Re: Yet another draw of rectangle humptydumpty <ouatubi@gmail.com> - 2016-11-20 03:33 -0800
          Re: Yet another draw of rectangle Paul Rubin <no.email@nospam.invalid> - 2016-11-20 08:52 -0800
          Re: Yet another draw of rectangle Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-20 12:05 -0600
          Re: Yet another draw of rectangle "HAA" <someone@microsoft.com> - 2016-11-21 10:43 +1100
            Re: Yet another draw of rectangle Paul Rubin <no.email@nospam.invalid> - 2016-11-20 16:25 -0800
              Re: Yet another draw of rectangle "HAA" <someone@microsoft.com> - 2016-11-21 15:20 +1100
                Re: Yet another draw of rectangle Paul Rubin <no.email@nospam.invalid> - 2016-11-22 00:02 -0800
                Re: Yet another draw of rectangle Mark Wills <markwills1970@gmail.com> - 2016-11-22 01:00 -0800
                Re: Yet another draw of rectangle Paul Rubin <no.email@nospam.invalid> - 2016-11-22 01:13 -0800
                Re: Yet another draw of rectangle "Robert L." <No_spamming@noWhere_7073.org> - 2016-11-22 20:54 +0000
                Yet another language ( was Yet another draw of rectangle) "HAA" <someone@microsoft.com> - 2016-11-27 13:32 +1100
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-11-26 18:52 -0800
                Re: Yet another language ( was Yet another draw of rectangle) "HAA" <someone@microsoft.com> - 2016-11-28 15:00 +1100
                Re: Yet another language ( was Yet another draw of rectangle) "Elizabeth D. Rather" <erather@forth.com> - 2016-11-27 18:32 -1000
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-11-27 20:44 -0800
                Re: Yet another language ( was Yet another draw of rectangle) "HAA" <someone@microsoft.com> - 2016-11-29 15:22 +1100
                Re: Yet another language ( was Yet another draw of rectangle) Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2016-11-29 00:42 -0500
                Re: Yet another language ( was Yet another draw of rectangle) "Elizabeth D. Rather" <erather@forth.com> - 2016-11-28 22:20 -1000
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-11-29 17:18 -0800
                Re: Yet another language ( was Yet another draw of rectangle) Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2016-11-29 23:15 -0500
                Re: Yet another language ( was Yet another draw of rectangle) Ron Aaron <rambamist@gmail.com> - 2016-11-30 07:08 +0200
                Re: Yet another language ( was Yet another draw of rectangle) "Elizabeth D. Rather" <erather@forth.com> - 2016-11-29 21:51 -1000
                Re: Yet another language ( was Yet another draw of rectangle) Ron Aaron <rambamist@gmail.com> - 2016-11-30 12:09 +0200
                Re: Yet another language ( was Yet another draw of rectangle) "Elizabeth D. Rather" <erather@forth.com> - 2016-11-30 09:43 -1000
                Re: Yet another language ( was Yet another draw of rectangle) Cecil Bayona <cbayona@cbayona.com> - 2016-11-30 17:36 -0600
                Re: Yet another language ( was Yet another draw of rectangle) "Elizabeth D. Rather" <erather@forth.com> - 2016-11-30 14:31 -1000
                Re: Yet another language ( was Yet another draw of rectangle) Ron Aaron <rambamist@gmail.com> - 2016-12-01 07:02 +0200
                Re: Yet another language ( was Yet another draw of rectangle) "Elizabeth D. Rather" <erather@forth.com> - 2016-12-01 08:58 -1000
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-01 16:44 -0800
                Re: Yet another language ( was Yet another draw of rectangle) "HAA" <someone@microsoft.com> - 2016-12-05 21:28 +1100
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-05 07:41 -0800
                Re: Yet another language ( was Yet another draw of rectangle) "HAA" <someone@microsoft.com> - 2016-12-06 18:13 +1100
                Re: Yet another language ( was Yet another draw of rectangle) "Elizabeth D. Rather" <erather@forth.com> - 2016-12-05 21:36 -1000
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-06 00:05 -0800
                Re: Yet another language ( was Yet another draw of rectangle) "HAA" <someone@microsoft.com> - 2016-12-08 10:09 +1100
                Re: Yet another language ( was Yet another draw of rectangle) Paul Rubin <no.email@nospam.invalid> - 2016-12-07 15:27 -0800
                Re: Yet another language ( was Yet another draw of rectangle) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-12-08 04:22 -0600
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-08 17:05 -0800
                Re: Yet another language ( was Yet another draw of rectangle) Mark Wills <markwills1970@gmail.com> - 2016-12-09 01:47 -0800
                Re: Yet another language ( was Yet another draw of rectangle) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-12-09 04:01 -0600
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-09 06:49 -0800
                Re: Yet another language ( was Yet another draw of rectangle) "HAA" <someone@microsoft.com> - 2016-12-10 10:15 +1100
                Re: Yet another language ( was Yet another draw of rectangle) josv@planet.nl - 2017-04-12 04:47 -0700
                Re: Yet another language ( was Yet another draw of rectangle) "Elizabeth D. Rather" <erather@forth.com> - 2016-12-07 14:34 -1000
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-07 18:39 -0800
                Re: Yet another language ( was Yet another draw of rectangle) "HAA" <someone@microsoft.com> - 2016-12-10 09:38 +1100
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-09 16:25 -0800
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-06 00:14 -0800
                Re: Yet another language ( was Yet another draw of rectangle) stephen@mpeforth.com (Stephen Pelc) - 2016-12-06 12:01 +0000
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-06 10:21 -0800
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-09 16:27 -0800
                Re: Yet another language ( was Yet another draw of rectangle) Rob Sciuk <rob@controlq.com> - 2017-04-08 21:05 -0400
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2017-04-08 18:57 -0700
                Re: Yet another language ( was Yet another draw of rectangle) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-09 05:28 -0700
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2017-04-09 06:45 -0700
                Re: Yet another language ( was Yet another draw of rectangle) Rob Sciuk <rob@controlq.com> - 2017-04-10 16:54 -0400
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2017-04-10 17:21 -0700
                Re: Yet another language ( was Yet another draw of rectangle) Jan Coombs <jenfhaomndgfwutc@murmic.plus.com> - 2017-04-11 08:03 +0100
                Re: Yet another language ( was Yet another draw of rectangle) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-11 07:50 +0000
                Re: Yet another language ( was Yet another draw of rectangle) Rob Sciuk <rob@controlq.com> - 2017-04-11 11:43 -0400
                Re: Yet another language ( was Yet another draw of rectangle) lehs <skydda.barnen@gmail.com> - 2017-04-11 10:16 -0700
                Re: Yet another language ( was Yet another draw of rectangle) Paul Rubin <no.email@nospam.invalid> - 2017-04-11 10:21 -0700
                Re: Yet another language ( was Yet another draw of rectangle) lehs <skydda.barnen@gmail.com> - 2017-04-11 10:48 -0700
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2017-04-11 23:58 -0700
                Re: Yet another language ( was Yet another draw of rectangle) rickman <gnuarm@gmail.com> - 2017-04-12 03:07 -0400
                Re: Yet another language ( was Yet another draw of rectangle) lehs <skydda.barnen@gmail.com> - 2017-04-12 00:29 -0700
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2017-04-12 00:55 -0700
                Re: Yet another language ( was Yet another draw of rectangle) rickman <gnuarm@gmail.com> - 2017-04-12 04:07 -0400
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2017-04-12 13:29 -0700
                Re: Yet another language ( was Yet another draw of rectangle) rickman <gnuarm@gmail.com> - 2017-04-12 16:51 -0400
                Re: Yet another language ( was Yet another draw of rectangle) lehs <skydda.barnen@gmail.com> - 2017-04-12 03:50 -0700
                Re: Yet another language ( was Yet another draw of rectangle) Lars Brinkhoff <lars.spam@nocrew.org> - 2017-04-12 12:55 +0200
                Re: Yet another language ( was Yet another draw of rectangle) lehs <skydda.barnen@gmail.com> - 2017-04-12 04:17 -0700
                Re: Yet another language ( was Yet another draw of rectangle) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-04-12 06:03 -0500
                Re: Yet another language ( was Yet another draw of rectangle) lehs <skydda.barnen@gmail.com> - 2017-04-12 04:30 -0700
                Re: Yet another language ( was Yet another draw of rectangle) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-04-12 08:44 -0500
                Re: Yet another language ( was Yet another draw of rectangle) rickman <gnuarm@gmail.com> - 2017-04-12 13:01 -0400
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2017-04-12 13:33 -0700
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2017-04-12 12:59 -0700
                Re: Yet another language ( was Yet another draw of rectangle) rickman <gnuarm@gmail.com> - 2017-04-12 17:05 -0400
                Re: Yet another language ( was Yet another draw of rectangle) Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-04-11 10:27 -0700
                Re: Yet another language ( was Yet another draw of rectangle) rickman <gnuarm@gmail.com> - 2017-04-11 14:02 -0400
                Re: Yet another language ( was Yet another draw of rectangle) Julian Fondren <julian.fondren@gmail.com> - 2017-04-08 20:10 -0700
                Re: Yet another language ( was Yet another draw of rectangle) rickman <gnuarm@gmail.com> - 2017-04-13 13:16 -0400
                Re: Yet another language ( was Yet another draw of rectangle) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-12-05 12:01 -0600
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-05 10:39 -0800
                Re: Yet another language ( was Yet another draw of rectangle) Alex <alex@rivadpm.com> - 2016-12-05 18:53 +0000
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-05 11:33 -0800
                Re: Yet another language ( was Yet another draw of rectangle) Alex <alex@rivadpm.com> - 2016-12-05 22:22 +0000
                Re: Yet another language ( was Yet another draw of rectangle) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-12-06 04:29 -0600
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-06 11:32 -0800
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-07 19:06 -0800
                Re: Yet another language ( was Yet another draw of rectangle) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-12-06 04:27 -0600
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-06 10:24 -0800
                Re: Yet another language ( was Yet another draw of rectangle) john <anon@example.com> - 2016-11-30 13:41 +0000
                Re: Yet another language ( was Yet another draw of rectangle) stephen@mpeforth.com (Stephen Pelc) - 2016-11-30 15:15 +0000
                Re: Yet another language ( was Yet another draw of rectangle) john <anon@example.com> - 2016-12-01 09:54 +0000
                Re: Yet another language ( was Yet another draw of rectangle) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-12-01 04:42 -0600
                Re: Yet another language ( was Yet another draw of rectangle) rickman <gnuarm@gmail.com> - 2017-04-12 13:09 -0400
                Re: Yet another language ( was Yet another draw of rectangle) rickman <gnuarm@gmail.com> - 2017-04-12 13:14 -0400
                Re: Yet another language ( was Yet another draw of rectangle) "Elizabeth D. Rather" <erather@forth.com> - 2017-04-12 08:32 -1000
                Re: Yet another language ( was Yet another draw of rectangle) lehs <skydda.barnen@gmail.com> - 2017-04-12 12:42 -0700
                Re: Yet another language ( was Yet another draw of rectangle) "Elizabeth D. Rather" <erather@forth.com> - 2017-04-12 10:36 -1000
                Re: Yet another language ( was Yet another draw of rectangle) rickman <gnuarm@gmail.com> - 2017-04-12 16:41 -0400
                Re: Yet another language ( was Yet another draw of rectangle) "Elizabeth D. Rather" <erather@forth.com> - 2017-04-12 13:25 -1000
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2017-04-12 14:13 -0700
                Re: Yet another language ( was Yet another draw of rectangle) rickman <gnuarm@gmail.com> - 2017-04-12 17:45 -0400
                Re: Yet another language ( was Yet another draw of rectangle) Mark Wills <markwills1970@gmail.com> - 2017-04-13 05:53 -0700
                Re: Yet another language ( was Yet another draw of rectangle) rickman <gnuarm@gmail.com> - 2017-04-13 13:34 -0400
                Re: Yet another language ( was Yet another draw of rectangle) john <anon@example.com> - 2016-11-29 11:48 +0000
                Re: Yet another language ( was Yet another draw of rectangle) stephen@mpeforth.com (Stephen Pelc) - 2016-11-29 14:24 +0000
                Re: Yet another language ( was Yet another draw of rectangle) john <anon@example.com> - 2016-11-29 21:27 +0000
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-11-29 18:15 -0800
                Re: Yet another language ( was Yet another draw of rectangle) Alex <alex@rivadpm.com> - 2016-11-30 10:03 +0000
                Re: Yet another language ( was Yet another draw of rectangle) hughaguilar96@gmail.com - 2016-12-01 16:14 -0800
                Re: Yet another language ( was Yet another draw of rectangle) "Elizabeth D. Rather" <erather@forth.com> - 2016-11-29 12:22 -1000
                Re: Yet another language ( was Yet another draw of rectangle) albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-29 14:31 +0100
                Re: Yet another language ( was Yet another draw of rectangle) "HAA" <someone@microsoft.com> - 2016-12-02 23:05 +1100
                Re: Yet another language ( was Yet another draw of rectangle) Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2016-12-03 01:58 -0500
                Re: Yet another language ( was Yet another draw of rectangle) "HAA" <someone@microsoft.com> - 2016-12-03 22:00 +1100
                Re: Yet another draw of rectangle "HAA" <someone@microsoft.com> - 2016-11-23 10:11 +1100
                Re: Yet another draw of rectangle Paul Rubin <no.email@nospam.invalid> - 2016-11-23 00:01 -0800
                Re: Yet another draw of rectangle albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-23 13:49 +0100
                Re: Yet another draw of rectangle foxaudioresearch@gmail.com - 2016-11-23 10:51 -0800
                Re: Yet another draw of rectangle "Elizabeth D. Rather" <erather@forth.com> - 2016-11-24 09:26 -1000
                Re: Yet another draw of rectangle Paul Rubin <no.email@nospam.invalid> - 2016-11-23 12:28 -0800
                Re: Yet another draw of rectangle hughaguilar96@gmail.com - 2016-11-24 16:54 -0800
                Re: Yet another draw of rectangle rickman <gnuarm@gmail.com> - 2016-11-25 02:20 -0500
                Re: Yet another draw of rectangle albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-25 10:39 +0100
                Re: Yet another draw of rectangle Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-11-22 04:17 -0600
                Re: Yet another draw of rectangle Paul Rubin <no.email@nospam.invalid> - 2016-11-22 10:38 -0800
                Re: Yet another draw of rectangle humptydumpty <ouatubi@gmail.com> - 2016-11-23 13:05 -0800
                Re: Yet another draw of rectangle Paul Rubin <no.email@nospam.invalid> - 2016-11-29 15:23 -0800
                Re: Yet another draw of rectangle Ron Aaron <rambamist@gmail.com> - 2016-11-24 07:46 +0200
                Re: Yet another draw of rectangle Paul Rubin <no.email@nospam.invalid> - 2016-11-23 21:59 -0800
                Re: Yet another draw of rectangle Ron Aaron <rambamist@gmail.com> - 2016-11-24 08:12 +0200
      Re: Yet another draw of rectangle rickman <gnuarm@gmail.com> - 2016-11-23 22:22 -0500
        Re: Yet another draw of rectangle humptydumpty <ouatubi@gmail.com> - 2016-11-23 21:14 -0800
          Re: Yet another draw of rectangle rickman <gnuarm@gmail.com> - 2016-11-24 01:06 -0500
          Re: Yet another draw of rectangle "HAA" <someone@microsoft.com> - 2016-11-25 11:56 +1100
  Re: Yet another draw of rectangle hughaguilar96@gmail.com - 2016-11-19 23:14 -0800
    Re: Yet another draw of rectangle hughaguilar96@gmail.com - 2016-11-24 18:11 -0800
      Re: Yet another draw of rectangle luser droog <mijoryx@yahoo.com> - 2016-11-24 18:58 -0800
        Re: Yet another draw of rectangle luser droog <mijoryx@yahoo.com> - 2016-11-24 20:01 -0800
  Re: Yet another draw of rectangle Ilya Tarasov <ilya74.tarasov@gmail.com> - 2016-11-20 14:08 -0800
  Re: Yet another draw of rectangle lehs <skydda.barnen@gmail.com> - 2017-04-11 06:41 -0700

csiph-web