]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: change surround to return type of ``seq2``.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 13 Dec 2020 19:08:38 +0000 (11:08 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 13 Dec 2020 19:08:38 +0000 (11:08 -0800)
This was the previous behavior, which follows the logic of returning
type of the "first sequence" in the output.

core/sequences/sequences.factor

index a0e9d79c4cb566d27082bb675480a56ac2cff2c2..a6650fa9b559a8f7c65c3bf1b335dd0de30703bb 100644 (file)
@@ -378,7 +378,7 @@ PRIVATE>
 : surround-as ( seq1 seq2 seq3 exemplar -- newseq )
     [ swap ] 2dip 3append-as ; inline
 
-: surround ( seq1 seq2 seq3 -- newseq ) pick surround-as ; inline
+: surround ( seq1 seq2 seq3 -- newseq ) over surround-as ; inline
 
 : glue-as ( seq1 seq2 seq3 exemplar -- newseq ) swapd 3append-as ; inline
 
@@ -844,7 +844,7 @@ PRIVATE>
     [ swap head-slice ] [ swap tail-slice ] bi-curry bi* ; inline
 
 : replace-slice ( new from to seq -- seq' )
-    snip-slice swapd 3append ;
+    snip-slice surround ;
 
 : remove-nth ( n seq -- seq' )
     [ [ dup 1 + ] dip snip-slice ] keep append-as ;