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


Groups > comp.lang.forth > #25073

Re: Forth loops don't inherently loop once

Newsgroups comp.lang.forth
Date 2013-08-08 09:22 -0700
References <5202165e$0$26865$e4fe514c@dreader37.news.xs4all.nl> <f158584f-8c0c-4cb7-9269-7a120533bb9b@googlegroups.com> <EOmdndNDjsyNDJ_PnZ2dnUVZ_tidnZ2d@supernews.com> <alpine.BSF.2.00.1308071507430.65315@yoko.controlq.com>
Message-ID <cf108400-a111-4515-9aaf-e47fba0492a5@googlegroups.com> (permalink)
Subject Re: Forth loops don't inherently loop once
From Brad Eckert <hwfwguy@gmail.com>

Show all headers | View raw


On Wednesday, August 7, 2013 3:09:42 PM UTC-4, Sp...@ControlQ.com wrote:
> 
> Actually, the BEGIN ... WHILE ... REPEAT loop is the best of all worlds, 
> in that the code between the BEGIN and WHILE is executed at least once, 
> and based upon stack effects, the WHILE ... REPEAT section may or may not 
> be executed at all.
> 
I used FOR and NEXT macros for a while, which were implemented with POSTPONEd BEGIN WHILE REPEAT. It was good for doing something 0 or more times. 

But then I found myself mostly using DO LOOP due to the low cost of LOOP. DO or ?DO only executes once, so a call to (DO) or (?DO) doesn't cost much even if it has to do some arithmetic to set up the loop parameters. If LOOP compiles to a DJNZ or whatever, that's cheap.

Back to comp.lang.forth | Previous | NextPrevious in thread | Find similar


Thread

Forth loops don't inherently loop once albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-08-07 09:41 +0000
  Re: Forth loops don't inherently loop once Mark Wills <markrobertwills@yahoo.co.uk> - 2013-08-07 04:46 -0700
    Re: Forth loops don't inherently loop once albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-08-07 12:49 +0000
      Re: Forth loops don't inherently loop once Mark Wills <markrobertwills@yahoo.co.uk> - 2013-08-07 05:56 -0700
        Re: Forth loops don't inherently loop once Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-08-07 08:32 -0500
    Re: Forth loops don't inherently loop once "Elizabeth D. Rather" <erather@forth.com> - 2013-08-07 08:25 -1000
      Re: Forth loops don't inherently loop once Spam@ControlQ.com - 2013-08-07 15:09 -0400
        Re: Forth loops don't inherently loop once "Elizabeth D. Rather" <erather@forth.com> - 2013-08-07 11:35 -1000
          Re: Forth loops don't inherently loop once Rob Sciuk <rob@controlq.com> - 2013-08-07 18:39 -0400
        Re: Forth loops don't inherently loop once Brad Eckert <hwfwguy@gmail.com> - 2013-08-08 09:22 -0700

csiph-web