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

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

From: Bulgrien, Dennis <Dennis.Bulgrien_at_TripointGlobal.com>
Date: Mon, 29 Nov 2004 14:06:30 -0600

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 .

COMPILER

\ DOWNTO subtracts one from the starting index of DO limits for a
decrementing -1 +LOOP so that the number of iterations is the same as if the
loop were counting up. e.g. 2 0 DO +1 +LOOP vs. 0 2 DOWNTO DO -1 +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 Mon Nov 29 2004 - 12:06:47 PST

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