[retroforth] Re: factoring request

  • From: Charles Childers <crc@xxxxxxxxxxxxxx>
  • To: retroforth@xxxxxxxxxxxxx
  • Date: Sun, 24 Oct 2004 07:45:45 -0400

Hi Stefan,

In the latest updates to 7.5 (not released yet), I rewrote s" in Forth, 
so this wasn't too hard to modify. Basically you do:

 macro
: s" '" parse
: $, 2dup s0 @ swap cmove swap drop s0 @ m: literal dup s0 @ + s0 ! m: 
literal ;
 forth

I'm not sure exactly why you have "['] compile" in the definition of 
".quote" though. I have an idea, which follows this example:

Anyway, the following code now works:
 forth
: .quote parse m: $, ;
 macro
: ." '" .quote ;
: .' '' .quote ;

You could also do this if you want ." to display the text:
 macro
: ." '" .quote ['] type compile ;

Out of curiosity, why would you want to split "create" into two parts?

--
Charles

Other related posts: