[comp.lang.forth] POSTFIX control structures

UNBCIC@BRFAPESP.BITNET (03/20/91)

I'm thinking in start to use postfix control structures. It should be easy to
add:
: PF-IF IF EXECUTE THEN ;
: PF-WHILE SWAP >R BEGIN WHILE R@ EXECUTE REPEAT R> DROP ;
and things like that. BUT.... how should I name them? Has anyone did something
like this before? I want a good name convention...

                              (8-DCS)
Daniel C. Sobral
UNBCIC@BRFAPESP.BITNET

wmb@MITCH.ENG.SUN.COM (Mitch Bradley) (03/21/91)

> I'm thinking in start to use postfix control structures. It should be easy to
> add:
> : PF-IF IF EXECUTE THEN ;
> : PF-WHILE SWAP >R BEGIN WHILE R@ EXECUTE REPEAT R> DROP ;
> and things like that. BUT.... how should I name them? Has anyone did
> something like this before? I want a good name convention...

How about:

  : ?EXECUTE  ( cfa flag -- ?? )  IF execute THEN  ;
  : #EXECUTE  ( cfa n -- ?? )  0 ?DO  >r r@ execute r>  LOOP  drop  ;
  : EXECUTE-WHILE  ( cfa -- ?? )
     >r  1  BEGIN WHILE  r@ execute  REPEAT  r> drop
  ;

Mitch

glenn@ludwig.sharebase.com (Glenn Linderman) (03/23/91)

Newsgroups: comp.lang.forth
Subject: Re: POSTFIX control structures
References: <9103210411.AA14477@ucbvax.Berkeley.EDU>
Sender: glenn@sharebase.com
Reply-To: glenn@sharebase.com (Glenn Linderman)
Followup-To: comp.lang.forth
Distribution: world
Organization: ShareBase
Keywords: postfix,control,structures

In article <9103210411.AA14477@ucbvax.Berkeley.EDU> UNBCIC%BRFAPESP.BITNET@SCFVM.GSFC.NASA.GOV writes:
>I'm thinking in start to use postfix control structures. It should be easy to
>add:
>: PF-IF IF EXECUTE THEN ;
>: PF-WHILE SWAP >R BEGIN WHILE R@ EXECUTE REPEAT R> DROP ;
>and things like that. BUT.... how should I name them? Has anyone did something
>like this before? I want a good name convention...
>
>                              (8-DCS)
>Daniel C. Sobral
>UNBCIC@BRFAPESP.BITNET

Careful: You may have meant

: PF-IF IF EXECUTE ELSE DROP THEN ;


Newsgroups: comp.lang.forth
Subject: Re: POSTFIX control structures
References: <9103210411.AA14477@ucbvax.Berkeley.EDU>
Sender: glenn@sharebase.com
Reply-To: glenn@sharebase.com (Glenn Linderman)
Followup-To: comp.lang.forth
Distribution: world
Organization: Teradata/ShareBase Corporation
Keywords: postfix,control,structures

In article <9103210411.AA14477@ucbvax.Berkeley.EDU> UNBCIC%BRFAPESP.BITNET@SCFVM.GSFC.NASA.GOV writes:
>I'm thinking in start to use postfix control structures. It should be easy to
>add:
>: PF-IF IF EXECUTE THEN ;
>: PF-WHILE SWAP >R BEGIN WHILE R@ EXECUTE REPEAT R> DROP ;
>and things like that. BUT.... how should I name them? Has anyone did something
>like this before? I want a good name convention...
>
>                              (8-DCS)
>Daniel C. Sobral
>UNBCIC@BRFAPESP.BITNET

Careful: You may have meant

: PF-IF IF EXECUTE ELSE DROP THEN ;