     [ id ]
     [ unclip id swap quot call( prev elt -- next ) quot reduce* ] if-empty ; inline recursive
 
-:: combos ( list1 list2 -- result ) list2 [ [ 2array ] curry list1 swap map ] map concat ;
-: find-all ( seq quot -- elts ) [ [ length iota ] keep ] dip
-    [ dupd call( a -- ? ) [ 2array ] [ 2drop f ] if ] curry 2map [ ] filter ; inline
+:: combos ( list1 list2 -- result )
+    list2 [ [ 2array ] curry list1 swap map ] map concat ;
 
-: insert-sorted ( elt seq -- seq ) 2dup [ < ] with find drop over length or swap insert-nth ;
+: find-all ( seq quot -- elts )
+    [ [ length iota ] keep ] dip
+    [ dupd call( a -- ? ) [ 2array ] [ 2drop f ] if ] curry
+    2map [ ] filter ; inline
+
+: insert-sorted ( elt seq -- seq )
+    2dup [ < ] with find drop over length or swap insert-nth ;
 
 : max-by ( obj1 obj2 quot: ( obj -- n ) -- obj1/obj2 )
     [ bi@ [ max ] keep eq? not ] curry most ; inline

    dup length [1,b] [ <clumps> ] with map concat ;

:: each-subseq ( ... seq quot: ( ... x -- ... ) -- ... )
    seq length [0,b] [
        :> from
        from seq length (a,b] [
            :> to
            from to seq subseq quot call( x -- )
        ] each

USING: arrays grouping kernel locals math math.order math.ranges
sequences sequences.private splitting ;

IN: sequences.extras

: reduce1 ( seq quot -- result ) [ unclip ] dip reduce ; inline

:: reduce-r ( list identity quot: ( obj1 obj2 -- obj ) -- result )
    list empty?
    [ identity ]
    [ list rest identity quot reduce-r list first quot call ] if ;
