cursors: -find iterator
parent
e0435f6261
commit
dbebe044c9
|
@ -8,6 +8,10 @@ IN: cursors.tests
|
|||
{ } make
|
||||
] unit-test
|
||||
|
||||
[ T{ linear-cursor f 3 1 } ] [
|
||||
T{ linear-cursor f 1 1 } T{ linear-cursor f 5 1 } [ value>> 3 mod zero? ] -find
|
||||
] unit-test
|
||||
|
||||
[ { 1 3 } ] [
|
||||
[ T{ linear-cursor f 1 2 } T{ linear-cursor f 5 2 } [ value>> , ] -each ]
|
||||
{ } make
|
||||
|
|
|
@ -125,6 +125,9 @@ M: end-of-stream cursor-stream-ended? drop t ; inline
|
|||
[ '[ dup _ cursor>= ] ]
|
||||
[ '[ _ keep inc-cursor ] ] bi* until drop ; inline
|
||||
|
||||
: -find ( ... begin end quot: ( ... cursor -- ... ? ) -- ... cursor )
|
||||
'[ dup _ cursor>= [ t ] [ dup @ ] if ] [ inc-cursor ] until ; inline
|
||||
|
||||
: -in- ( quot -- quot' )
|
||||
'[ cursor-value-unsafe @ ] ; inline
|
||||
|
||||
|
|
Loading…
Reference in New Issue