embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

Re: a-addr2 a-addr1 DOWNTO DO -1 +LOOP

From: Bulgrien, Dennis <Dennis.Bulgrien_at_TripointGlobal.com>
Date: Wed, 1 Dec 2004 09:10:57 -0600

Perhaps it would be more intuitive if it did more, for the bounds put in
usual order. Thus:

: DOWNTO ( u2 u0 -- u0 u1 ) SWAP 1- ;

: up 2 0 DO I . 1 +LOOP ; ok
up 0 1 ok

: dn 2 0 DOWNTO DO I . -1 +LOOP ;
dn 1 0 ok

But then it reduces speed, increases size...

-----Original Message-----
Sent: Monday, November 29, 2004 14:07
Subject: [swiftx] a-addr1 a-addr2 DOWNTO DO -1 +LOOP

Here is an idea to make for-loop code more readable: a word called DOWNTO
which adjusts that starting index by one so the bounds act like an
incrementing LOOP .

...

: DOWNTO ( -- ) ( a-addr1 a-addr2 -- a-addr1 a-addr2' ) POSTPONE 1- ;
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
For list command help, send subject "help" to swiftx-request_at_forth.com
Message archives are located at http://www.forth.com/archive/swiftx
----------------------------------------------------------------------
This list is a forum for SwiftX users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Wed Dec 01 2004 - 07:11:25 PST

This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:50 PST