Bubble Sort in Forth (for strings) I wrote the following Forth code for sorting a string with the Bubble Sort method.
It looks nice to my eyes, but I'd like your experienced opinion and any comments about the code you might have.

In the compare-and-swap-next word, is using the return stack to save base address of string ok?
the bubblesort word uses 2 pick which is not so bad? A previous version had 5 pick (!), anyway ... is 2 pick fine: don't overthink about that or maybe try some more refactoring?
How would I go about adding a check for any swaps in each round and terminate the sort early? A variable? A stack cell (on TOS)? Rethink all of the implementation?

: compare-and-swap-next ( string i -- )
   2dup + dup &gt;r c@ rot rot 1 + + c@ 2dup &gt;
   if     r@ c! r&gt; 1 + c!
   else   r&gt; drop 2drop
   then ;

: bubblesort ( string len -- string len )
   dup 1 -
   begin  dup 0&gt;
   while  dup 0
          do   2 pick i compare-and-swap-next
          loop
          1 -
   repeat
   drop ;

\ s&quot; abracadabra&quot; bubblesort \ cr type
\ s&quot; The quick brown fox&quot; bubblesort \ cr type
\ s&quot; a quick brown fox jumps over the lazy dog.&quot; bubblesort \ cr type

Code available on github
Nitpicks welcome! Pedantism welcome!
Thank you!
To address your immediate concerns,

Using the return stack for storing your temporaries is a perfectly valid technique.

pick is always frown upon (as well as tuck, roll, and friends). It seems that the len parameter to bubblesort does not participate in computation - except the very beginning - and mostly just stays in the way. Consider
 : bubblesort
     dup &gt;r 1-
     ....



and use over instead of 2 pick (don't forget to r&gt; the length at the end).

I prefer a slightly different formatting of conditional. Consider
2dup &gt; if     
    r@ c! r&gt; 1 + c!  else   
    r&gt; drop 2drop then ;

Same for the loops. Consider
: bubblesort ( string len -- string len )
    dup 1 - begin 
    dup 0&gt; while
        dup 0 do                                      
            2 pick i compare-and-swap-next               
        loop
        1 -                                     
    repeat
drop ;

Keeping control words together with their respective conditions/actions looks more Forthy for me.

r&gt; drop is also known as rdrop.
rot rot is also known as -rot.