From 00bd0c52e7bb444379eee7d95476f0c5e1e4e085 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 27 Apr 2014 17:13:26 -0700 Subject: [PATCH] sorting.insertion: skip the zero'th element. --- basis/sorting/insertion/insertion.factor | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/basis/sorting/insertion/insertion.factor b/basis/sorting/insertion/insertion.factor index a1752b6742..2145e46927 100644 --- a/basis/sorting/insertion/insertion.factor +++ b/basis/sorting/insertion/insertion.factor @@ -2,6 +2,7 @@ USING: kernel locals math sequences sequences.private ; IN: sorting.insertion = [ @@ -9,8 +10,9 @@ IN: sorting.insertion seq quot n 1 - insert ] unless ] unless ; inline recursive + PRIVATE> : insertion-sort ( ... seq quot: ( ... elt -- ... elt' ) -- ... ) ! quot is a transformation on elements - over length [ insert ] with with each-integer ; inline + over length [ insert ] with with 1 -rot (each-integer) ; inline