]> gitweb.factorcode.org Git - factor.git/commitdiff
make new-resizable on growable sequences return a growable of the same type
authorJoe Groff <arcata@gmail.com>
Thu, 22 Oct 2009 23:55:00 +0000 (18:55 -0500)
committerJoe Groff <arcata@gmail.com>
Thu, 22 Oct 2009 23:55:00 +0000 (18:55 -0500)
basis/vectors/functor/functor.factor
core/byte-vectors/byte-vectors.factor
core/growable/growable.factor
core/sbufs/sbufs.factor

index b70c7c50509a1ed6b4571447b85913e3b0d650ed..a2a67d58bc6e09efeb17a64042cd8390a0af96e8 100644 (file)
@@ -24,6 +24,8 @@ M: V new-sequence drop [ <A> ] [ >fixnum ] bi V boa ; inline
 
 M: A new-resizable drop <V> ; inline
 
+M: V new-resizable drop <V> ; inline
+
 M: V equal? over V instance? [ sequence= ] [ 2drop f ] if ;
 
 : >V ( seq -- vector ) V new clone-like ; inline
index 287e9724051a91ead34cad6453cafce3cefdd36d..4f6ade858068b5a22385987f495381e57095ceba 100644 (file)
@@ -43,4 +43,6 @@ M: byte-array like
 \r
 M: byte-array new-resizable drop <byte-vector> ; inline\r
 \r
+M: byte-vector new-resizable drop <byte-vector> ; inline\r
+\r
 INSTANCE: byte-vector growable\r
index 68a8de3d43072c0913164aa78de6912da4a4490d..2ca11e2e24ec4606cbf4f3a5314a0fb5788808b1 100644 (file)
@@ -66,4 +66,6 @@ M: growable shorten ( n seq -- )
         2dup (>>length)
     ] when 2drop ; inline
 
+M: growable new-resizable new-sequence 0 over set-length ; inline
+
 INSTANCE: growable sequence
index 49b6ec137406cccc9901231e0bcdcc914f4b47a0..db2649142d7b408203d7d3dad35ee1e20aecd10a 100644 (file)
@@ -23,13 +23,13 @@ M: sbuf like
         dup string? [ dup length sbuf boa ] [ >sbuf ] if
     ] unless ; inline
 
-M: sbuf new-resizable drop <sbuf> ; inline
-
 M: sbuf equal?
     over sbuf? [ sequence= ] [ 2drop f ] if ;
 
 M: string new-resizable drop <sbuf> ; inline
 
+M: sbuf new-resizable drop <sbuf> ; inline
+
 M: string like
     #! If we have a string, we're done.
     #! If we have an sbuf, and it's at full capacity, we're done.