Author: | Rich |
---|---|
Mode: | factor |
Date: | Sat, 30 May 2009 03:55:04 |
: insertion-sort ( seq -- ) 1 over length 1- [ 2dup swap nth 2over [ 3dup [ 2nip 0 > ] [ 1- swap nth < ] 2array 3&& ] [ dup 1- pick nth 2over swap set-nth 1- ] while swap set-nth 1+ ] times 2drop ;