]> gitweb.factorcode.org Git - factor.git/blob - basis/splitting/monotonic/monotonic.factor
Conflict resolution
[factor.git] / basis / splitting / monotonic / monotonic.factor
1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: make namespaces sequences kernel fry ;
4 IN: splitting.monotonic
5
6 : ,, ( obj -- ) building get peek push ;
7 : v, ( -- ) V{ } clone , ;
8 : ,v ( -- ) building get dup peek empty? [ dup pop* ] when drop ;
9
10 : (monotonic-split) ( seq quot -- newseq )
11     [
12         [ dup unclip suffix ] dip
13         v, '[ over ,, @ [ v, ] unless ] 2each ,v
14     ] { } make ; inline
15
16 : monotonic-split ( seq quot -- newseq )
17     over empty? [ 2drop { } ] [ (monotonic-split) ] if ; inline