Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #10205
| From | Arnold Doray <invalid@invalid.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | DO... LOOP question |
| Date | 2012-03-18 15:52 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <jk50b8$i6f$1@dont-email.me> (permalink) |
Dear Forthers,
The '93 spec shows how to define ELSE, REPEAT and WHILE in terms of IF,
THEN, BEGIN, AGAIN, UNTIL, AHEAD, CS-ROLL and CS-PICK. I was wondering if
these primitives could be used to define DO ... LOOP and friends?
I could only come up with an un-nestable solution:
\ Repeat is from the '94 spec.
: repeat
postpone again
postpone then ; immediate
: unloop
R> R> 2drop ;
: (loop-inc)
R> + >R ;
: (loop)
postpone (loop-inc)
postpone repeat
postpone unloop ; immediate
: +loop
postpone (loop) ; immediate
: loop
1 postpone literal
postpone +loop ; immediate
: (do-setup)
swap >R >R ;
: (do-test)
R> dup R@ < swap >R ;
: do
postpone (do-setup)
postpone begin
postpone (do-test)
postpone if
1 cs-roll ; immediate
: i R@ ;
Any suggestions?
Thanks,
Arnold
Back to comp.lang.forth | Previous | Next — Next in thread | Find similar
DO... LOOP question Arnold Doray <invalid@invalid.com> - 2012-03-18 15:52 +0000
Re: DO... LOOP question Coos Haak <chforth@hccnet.nl> - 2012-03-18 17:08 +0100
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-18 09:41 -0700
Re: DO... LOOP question Coos Haak <chforth@hccnet.nl> - 2012-03-18 20:51 +0100
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-18 14:37 -0700
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-18 15:56 -0700
Re: DO... LOOP question Coos Haak <chforth@hccnet.nl> - 2012-03-19 01:04 +0100
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-18 17:25 -0700
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-18 17:43 -0700
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-18 18:48 -0700
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-18 21:49 -0700
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-19 11:39 -0700
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-20 12:16 -0700
Re: DO... LOOP question Arnold Doray <invalid@invalid.com> - 2012-03-20 16:54 +0000
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-20 11:41 -0700
Re: DO... LOOP question Arnold Doray <invalid@invalid.com> - 2012-03-24 17:29 +0000
Re: DO... LOOP question Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-24 13:22 -0500
Re: DO... LOOP question Arnold Doray <invalid@invalid.com> - 2012-03-25 04:09 +0000
Re: DO... LOOP question Coos Haak <chforth@hccnet.nl> - 2012-03-25 13:49 +0200
Re: DO... LOOP question Arnold Doray <invalid@invalid.com> - 2012-03-27 17:47 +0000
Re: DO... LOOP question Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-25 19:45 +0000
Re: DO... LOOP question Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-26 04:26 -0500
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-26 07:28 -0700
Re: DO... LOOP question Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-26 10:03 -0500
Re: DO... LOOP question Coos Haak <chforth@hccnet.nl> - 2012-03-26 18:47 +0200
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-26 09:53 -0700
Re: DO... LOOP question Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-27 11:21 +0000
Re: DO... LOOP question Helmar Wodtke <helmwo@gmail.com> - 2012-03-27 04:34 -0700
Re: DO... LOOP question Coos Haak <chforth@hccnet.nl> - 2012-03-27 17:33 +0200
Re: DO... LOOP question Helmar Wodtke <helmwo@gmail.com> - 2012-03-27 09:19 -0700
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-27 12:20 -0700
Re: DO... LOOP question "Elizabeth D. Rather" <erather@forth.com> - 2012-03-27 09:34 -1000
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-27 13:00 -0700
Re: DO... LOOP question Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-26 20:16 -0700
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-24 11:37 -0700
Re: DO... LOOP question Arnold Doray <invalid@invalid.com> - 2012-03-25 06:39 +0000
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-25 06:19 -0700
Re: DO... LOOP question "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-21 05:48 -0400
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-21 08:36 -0700
Re: DO... LOOP question BruceMcF <agila61@netscape.net> - 2012-03-21 11:24 -0700
Re: DO... LOOP question Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-21 03:01 -0700
Re: DO... LOOP question Arnold Doray <invalid@invalid.com> - 2012-03-24 17:44 +0000
Re: DO... LOOP question Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-25 11:57 +0000
Re: DO... LOOP question Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-26 20:14 -0700
Re: DO... LOOP question Arnold Doray <invalid@invalid.com> - 2012-03-27 16:46 +0000
csiph-web