: prep-car-compare @ car rot @ car 2swap ; : cell- 1 cells - ; : str<= compare dup 0= swap 0< or ; : str> compare 0> ; : partition ( left right -- L1 R1 L2 R2 ) 2dup 2>r \ retain L1 R2 dup >r cell- begin 2dup < while swap ( right left ) begin dup r@ prep-car-compare str<= while cell+ repeat swap begin dup r@ prep-car-compare str> while cell- repeat 2dup < if 2dup exchange then repeat r> drop ( L2 R1 ) r> swap r> swap 2swap ( L1 R1 L2 R2 ) \ pivot is at R2 cell- ;