]> gitweb.factorcode.org Git - factor.git/commitdiff
pack: use cum-sum0 from math.statistics.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 15 Jul 2015 00:49:04 +0000 (17:49 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 15 Jul 2015 00:49:04 +0000 (17:49 -0700)
basis/pack/pack.factor

index c1aca45922f4377f1e3cf6d80456edbcc6316b9e..dc7c2282aae0c88f1ba1197620d937ad8cd4b416 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2009 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien.c-types ascii assocs combinators combinators.smart
-endian fry io kernel macros math math.vectors sequences strings ;
+endian fry io kernel macros math math.statistics math.vectors
+sequences strings ;
 IN: pack
 
 GENERIC: >n-byte-array ( obj n -- byte-array )
@@ -115,7 +116,7 @@ MACRO: pack ( str -- quot )
 <PRIVATE
 
 : start/end ( seq -- seq1 seq2 )
-    [ 0 [ + ] accumulate nip dup ] keep v+ ; inline
+    [ cum-sum0 ] keep v+ ; inline
 
 PRIVATE>