Sort three variables: Difference between revisions

Line 497:
 
\ non-destructive print 3 counted-strings from data stack
: .STRS ( caddr1 caddr2 caddr3 -- caddr1 caddr2 caddr3 )
3 0 DO ROT 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 '.STRS'.
<PRE> ok
X Y Z ok
.S <3> 2142061672 2142061760 2142061848 ok
.STRS
lions, tigers, and
(from the "Wizard of OZ")
bears, oh my! ok
lions, tigers, and ok
ok
SORT3STRINGS ok
.S <3> 2142061848 2142061760 2142061672 ok
.STRS
(from the "Wizard of OZ")
lions, tigers, and
bears, oh my! ok
(from the "Wizard of OZ") ok</PRE>
</PRE>
 
=={{header|Fortran}}==
Anonymous user