parent
0cf0b91aad
commit
47cedd8d3d
|
@ -25,7 +25,7 @@ INSTANCE: slice-chunking chunking
|
|||
INSTANCE: slice-chunking sequence
|
||||
|
||||
M: slice-chunking nth group@ <slice> ; inline
|
||||
M: slice-chunking nth-unsafe group@ slice boa ; inline
|
||||
M: slice-chunking nth-unsafe group@ <slice-unsafe> ; inline
|
||||
|
||||
MIXIN: abstract-groups
|
||||
INSTANCE: abstract-groups sequence
|
||||
|
|
|
@ -103,7 +103,7 @@ PRIVATE>
|
|||
collector [ each-match ] dip >array ; inline
|
||||
|
||||
: all-matching-slices ( string regexp -- seq )
|
||||
[ slice boa ] map-matches ;
|
||||
[ <slice-unsafe> ] map-matches ;
|
||||
|
||||
: all-matching-subseqs ( string regexp -- seq )
|
||||
[ subseq ] map-matches ;
|
||||
|
@ -126,14 +126,14 @@ PRIVATE>
|
|||
:: first-match ( string regexp -- slice/f )
|
||||
string regexp prepare-match-iterator do-next-match [
|
||||
regexp reverse-regexp? [ [ 1 + ] bi@ ] when
|
||||
string slice boa
|
||||
string <slice-unsafe>
|
||||
] [ 2drop f ] if ;
|
||||
|
||||
: re-contains? ( string regexp -- ? )
|
||||
prepare-match-iterator do-next-match [ 2drop ] dip >boolean ;
|
||||
|
||||
: re-split ( string regexp -- seq )
|
||||
[ slice boa ] (re-split) ;
|
||||
[ <slice-unsafe> ] (re-split) ;
|
||||
|
||||
: re-replace ( string regexp replacement -- result )
|
||||
[ [ subseq ] (re-split) ] dip join ;
|
||||
|
|
|
@ -64,7 +64,7 @@ TUPLE: sequence-parser sequence n ;
|
|||
[ 2drop 0 < ]
|
||||
[ [ drop ] 2dip length > ]
|
||||
[ drop > ]
|
||||
} 3|| [ 3drop f ] [ slice boa ] if ; inline
|
||||
} 3|| [ 3drop f ] [ <slice-unsafe> ] if ; inline
|
||||
|
||||
:: take-sequence ( sequence-parser sequence -- obj/f )
|
||||
sequence-parser [ n>> dup sequence length + ] [ sequence>> ] bi
|
||||
|
|
|
@ -21,7 +21,7 @@ MACRO: boa-unsafe ( class -- quot ) tuple-layout '[ _ <tuple-boa> ] ;
|
|||
[ new ] [ smart-tuple>array ] bi ; inline
|
||||
|
||||
: tuple-slice ( n seq -- slice )
|
||||
[ n>> [ * dup ] keep + ] [ seq>> ] bi slice boa ; inline
|
||||
[ n>> [ * dup ] keep + ] [ seq>> ] bi <slice-unsafe> ; inline
|
||||
|
||||
: read-tuple ( slice class -- tuple )
|
||||
'[ _ boa-unsafe ] input<sequence-unsafe ; inline
|
||||
|
|
|
@ -234,7 +234,7 @@ PRIVATE>
|
|||
: <slice> ( from to seq -- slice )
|
||||
check-slice
|
||||
dup slice? [ collapse-slice ] when
|
||||
slice boa ; inline
|
||||
<slice-unsafe> ; inline
|
||||
|
||||
M: slice virtual-exemplar seq>> ; inline
|
||||
|
||||
|
|
Loading…
Reference in New Issue