: overlap? ( array array -- ? ) ! { from to } 2dup [ second ] [ first ] bi* > [ [ first ] [ second ] bi* >= [ f ] [ t ] if ] [ 2drop f ] if ; inline : spaces ( seq seq -- seq ? ) 2dup [ overlap? ] curry map sift empty? [ suffix t ] [ drop f ] if ; : spaces2 ( seq seq -- seq ) 2dup [ overlap? ] curry map sift empty? [ suffix ] [ "overlap" write nl drop ] if ; : non-overlaps ( seq -- seq ) { } [ spaces2 ] reduce ; : (overlaps?) ( seqs seq -- ? ) [ overlap? ] curry find 2array { f f } = not ; : seq-overlaps? ( seq -- ? ) dup empty? [ drop f ] [ [ rest ] [ 1 head first ] bi 2dup (overlaps?) [ 2drop t ] [ drop seq-overlaps? ] if ] if ; recursive { { 1 2 } { 2 3 } { 5 8 } { 4 6 } { 10 12 } } 7000000 { 14 18 } append [ seq-overlaps? ] curry time ! 6.234375 seconds ! tried rest-slice but it didn't make much difference. ! why is it linear when find in (overlaps?) should stop at the fourth item ? ! in other words: shouldn't it be equal to { { 1 2 } { 2 3 } { 5 8 } { 4 6 } { 10 12 } } [ seq-overlaps? ] curry time