Jump to content

Sort three variables: Difference between revisions

Line 496:
: SORT3STRINGS ?SWAPSTR >R ?SWAPSTR R> ?SWAPSTR ;
 
\ non-destructive print 3 counted-strings from data stack
: .STRSTRS ( caddr1 caddr2 caddr3 -- caddr1 caddr2 caddr3 )
3 0 DO DUP CR COUNT TYPE ROT LOOP ;
</LANG>
With these extensions we can do the same testing at the Forth console and
examine the string order with '.STRSTRS'.
<PRE>ok
X Y Z ok
.STRS
.STR
lions, tigers, and
(from the "Wizard of OZ")
Line 509 ⟶ 510:
ok
SORT3STRINGS ok
.STRS
.STR
(from the "Wizard of OZ")
lions, tigers, and
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.