modern.slices: Add a way to push characters back to the buffer.
parent
411c2376c7
commit
06e40a39bc
|
@ -219,3 +219,10 @@ ERROR: subseq-expected-but-got-eof n string expected ;
|
||||||
dup length 1 = [
|
dup length 1 = [
|
||||||
-1 modify-to [ 1 - ] 2dip
|
-1 modify-to [ 1 - ] 2dip
|
||||||
] unless ;
|
] unless ;
|
||||||
|
|
||||||
|
: rewind-slice ( n string slice -- n' string )
|
||||||
|
pick [
|
||||||
|
length swap [ - ] dip
|
||||||
|
] [
|
||||||
|
[ nip ] dip [ [ length ] bi@ - ] 2keep drop
|
||||||
|
] if ; inline
|
Loading…
Reference in New Issue