make new-resizable on growable sequences return a growable of the same type
parent
e31ed3eda4
commit
cdd0e5774e
|
@ -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
|
||||
|
|
|
@ -43,4 +43,6 @@ M: byte-array like
|
|||
|
||||
M: byte-array new-resizable drop <byte-vector> ; inline
|
||||
|
||||
M: byte-vector new-resizable drop <byte-vector> ; inline
|
||||
|
||||
INSTANCE: byte-vector growable
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue