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
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 09-Feb-2012. Archive updated nightly.