diff --git a/basis/compiler/tests/optimizer.factor b/basis/compiler/tests/optimizer.factor index 2e305b2c39..13917fd6bf 100644 --- a/basis/compiler/tests/optimizer.factor +++ b/basis/compiler/tests/optimizer.factor @@ -193,25 +193,6 @@ M: number detect-number ; ! Regression [ 4 [ + ] ] [ 2 2 [ [ + ] [ call ] keep ] compile-call ] unit-test -! Regression -USE: sorting -USE: binary-search -USE: binary-search.private - -: old-binsearch ( elt quot: ( ..a -- ..b ) seq -- elt quot i ) - dup length 1 <= [ - from>> - ] [ - [ midpoint swap call ] 3keep [ rot ] dip swap dup zero? - [ drop dup from>> swap midpoint@ + ] - [ drop dup midpoint@ head-slice old-binsearch ] if - ] if ; inline recursive - -[ 10 ] [ - 10 20 iota - [ [ - ] swap old-binsearch ] compile-call 2nip -] unit-test - ! Regression : empty-compound ( -- ) ; diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor index f7f774ad86..e6c656f2da 100644 --- a/core/sequences/sequences-docs.factor +++ b/core/sequences/sequences-docs.factor @@ -679,16 +679,11 @@ HELP: collapse-slice { $description "Prepares to take the slice of a slice by adjusting the start and end indices accordingly, and replacing the slice with its underlying sequence." } ; -HELP: -{ $values { "seq" sequence } { "slice" slice } } -{ $description "Outputs a slice with the same elements as " { $snippet "seq" } ", and " { $snippet "from" } " equal to 0 and " { $snippet "to" } " equal to the length of " { $snippet "seq" } "." } -{ $notes "Some words create slices then proceed to read the " { $snippet "to" } " and " { $snippet "from" } " slots of the slice. To behave predictably when they are themselves given a slice as input, they apply this word first to get a canonical slice." } ; - HELP: { $values { "from" "a non-negative integer" } { "to" "a non-negative integer" } { "seq" sequence } { "slice" slice } } { $description "Outputs a new virtual sequence sharing storage with the subrange of elements in " { $snippet "seq" } " with indices starting from and including " { $snippet "m" } ", and up to but not including " { $snippet "n" } "." } { $errors "Throws an error if " { $snippet "m" } " or " { $snippet "n" } " is out of bounds." } -{ $notes "Taking the slice of a slice outputs a slice of the underlying sequence of the original slice. Keep this in mind when writing code which depends on the values of " { $snippet "from" } " and " { $snippet "to" } " being equal to the inputs to this word. The " { $link } " word might be helpful in such situations." } ; +{ $notes "Taking the slice of a slice outputs a slice of the underlying sequence, instead of a slice of a slice. This means that you cannot assume that the " { $snippet "from" } " and " { $snippet "to" } " slots of the resulting slice will be equal to the values you passed to " { $link } "." } ; { subseq } related-words @@ -1534,8 +1529,6 @@ $nl { $subsections rest-slice but-last-slice } "Taking a sequence apart into a head and a tail:" { $subsections unclip-slice unclip-last-slice cut-slice } -"A utility for words which use slices as iterators:" -{ $subsections } "Replacing slices with new elements:" { $subsections replace-slice } ; diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor index d9c234e717..2155f1439f 100644 --- a/core/sequences/sequences.factor +++ b/core/sequences/sequences.factor @@ -898,11 +898,6 @@ PRIVATE> : unclip-last-slice ( seq -- butlast-slice last ) [ but-last-slice ] [ last ] bi ; inline -: ( seq -- slice ) - dup slice? [ { } like ] when - [ drop 0 ] [ length ] [ ] tri ; - inline -