]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: change trim-head to not call length unless it needs to.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 8 Jan 2014 18:19:26 +0000 (10:19 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 8 Jan 2014 18:19:26 +0000 (10:19 -0800)
core/sequences/sequences.factor

index 6a1d0a10ee28ecdf34267cb1ff02c560e98eed93..ea035249d6f56f214effcf2f8c941b0da2287834 100644 (file)
@@ -985,8 +985,8 @@ PRIVATE>
 <PRIVATE
 
 : (trim-head) ( seq quot -- seq n )
-    over [ [ not ] compose find drop ] dip
-    [ length or ] keep swap ; inline
+    over [ [ not ] compose find drop ] dip swap
+    [ dup length ] unless* ; inline
 
 : (trim-tail) ( seq quot -- seq n )
     over [ [ not ] compose find-last drop ?1+ ] dip