( scratchpad ) :: rcopy ( src dst -- ) src length iota [ [ src nth ] [ dst set-nth ] bi ] each ; :: insert-sort-at ( seq n -- ) n seq nth :> val seq n head-slice :> head head [ val > ] find drop :> pivot pivot [ head seq [ pivot tail-slice ] bi@ 1 tail-slice rcopy val pivot seq set-nth ] when ; ( scratchpad ) 10 [ 100 iota random ] replicate dup . [ dup length [ insert-sort-at ] with each ] keep . { 80 73 22 44 56 94 76 17 8 76 } { 8 17 22 44 56 73 76 76 80 94 }