]> gitweb.factorcode.org Git - factor.git/commitdiff
Revert "core: find-last-integer -> find-last-integer-from for symmetry"
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 27 Jul 2022 03:16:57 +0000 (22:16 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 31 Jul 2022 18:24:58 +0000 (13:24 -0500)
This reverts commit 27bd3fe046ebec2624b83251be79117a2e132996.

core/math/math-docs.factor
core/math/math.factor
core/sequences/sequences.factor
extra/benchmark/mandel/mandel.factor
extra/boyer-moore/boyer-moore.factor
extra/sequences/extras/extras.factor
misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage
misc/atom/grammars/factor.cson
misc/vim/syntax/factor/generated.vim

index 6fb62b34e8e6f3f1bee39e4ad7fb38228d9639a0..82f44375fbca19c9f4b9752e486e1b8c411c85ce 100644 (file)
@@ -454,7 +454,7 @@ HELP: find-integer
 { $description "Applies the quotation to each integer from 0 up to " { $snippet "n" } ", excluding " { $snippet "n" } ". Iteration stops when the quotation outputs a true value or the end is reached. If the quotation yields a true value for some integer, this word outputs that integer. Otherwise, this word outputs " { $link f } "." }
 { $notes "This word is used to implement " { $link find } "." } ;
 
-HELP: find-last-integer-from
+HELP: find-last-integer
 { $values { "n" integer } { "quot" { $quotation ( ... i -- ... ? ) } } { "i/f" { $maybe integer } } }
 { $description "Applies the quotation to each integer from " { $snippet "n" } " down to 0, inclusive. Iteration stops when the quotation outputs a true value or 0 is reached. If the quotation yields a true value for some integer, the word outputs that integer. Otherwise, the word outputs " { $link f } "." }
 { $notes "This word is used to implement " { $link find-last } "." } ;
index 548e628cc716bb14d4fd82fd6a5eaab19ef39aac..c4178b0f0984049ae429bc71f0376e91b02f72ca 100644 (file)
@@ -264,17 +264,6 @@ GENERIC: prev-float ( m -- n )
         3drop f
     ] if ; inline recursive
 
-: find-last-integer-from ( ... n quot: ( ... i -- ... ? ) -- ... i/f )
-    over 0 < [
-        2drop f
-    ] [
-        [ call ] 2keep rot [
-            drop
-        ] [
-            [ 1 - ] dip find-last-integer-from
-        ] if
-    ] if ; inline recursive
-
 : all-integers-from? ( ... i n quot: ( ... i -- ... ? ) -- ... ? )
     2over < [
         [ nip call ] 3keep roll
@@ -295,3 +284,14 @@ GENERIC: prev-float ( m -- n )
 
 : all-integers? ( ... n quot: ( ... i -- ... ? ) -- ... ? )
     [ 0 ] 2dip all-integers-from? ; inline
+
+: find-last-integer ( ... n quot: ( ... i -- ... ? ) -- ... i/f )
+    over 0 < [
+        2drop f
+    ] [
+        [ call ] 2keep rot [
+            drop
+        ] [
+            [ 1 - ] dip find-last-integer
+        ] if
+    ] if ; inline recursive
index 716067d7cc92d87aa12c097391af319f9327fd86..cf4514ff904309d0529a9fcb1899dec650abe8ec 100644 (file)
@@ -557,7 +557,7 @@ PRIVATE>
     index/element ; inline
 
 : find-last-from-unsafe ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )
-    [ rot sequence-operator-last-from find-last-integer-from ] keepd
+    [ rot sequence-operator-last-from find-last-integer ] keepd
     index/element ; inline
 
 PRIVATE>
index d3f72c41e8afc0ae94663861bb531b4d421643ae..00861f819b89346ee276adfda52161184461a2dd 100644 (file)
@@ -14,7 +14,7 @@ IN: benchmark.mandel
 : c ( i j -- c ) scale center width height scale 2 / - + ; inline
 
 : count-iterations ( z max-iterations step-quot test-quot -- #iters )
-    '[ drop @ dup @ ] find-last-integer-from nip ; inline
+    '[ drop @ dup @ ] find-last-integer nip ; inline
 
 : pixel ( c -- iterations )
     [ C{ 0.0 0.0 } max-iterations ] dip
index 34e5e90ad23efb753b8e30dc3314c05cf3322850..922666742505450a3a60d26922669025f4f82a57 100644 (file)
@@ -46,7 +46,7 @@ TUPLE: boyer-moore pattern bad-char-table good-suffix-table ;
 
 :: mismatch? ( s1 s2 pos len -- i/f )
     len 1 - [ [ pos + s1 ] keep s2 match? not ]
-    find-last-integer-from ; inline
+    find-last-integer ; inline
 
 :: (search-from) ( seq from boyer-moore -- i/f )
     boyer-moore pattern>> :> pat
index 55398ef9822c7b9172c8c685136c73b1f47e487c..81bf964762b59cd8017ab9656a4fb1bfb771a5e0 100644 (file)
@@ -646,7 +646,7 @@ PRIVATE>
     over [ count ] [ length ] bi* / ; inline
 
 : find-last-index ( ... seq quot: ( ... elt i -- ... ? ) -- ... i elt )
-    [ [ 1 - ] dip find-last-integer-from ] (find-index) ; inline
+    [ [ 1 - ] dip find-last-integer ] (find-index) ; inline
 
 : map-find-last-index ( ... seq quot: ( ... elt index -- ... result/f ) -- ... result i elt )
     [ find-last-index ] (map-find-index) ; inline
index 08ac7e9436dd2faa79ae2608ae33988e3c42e78c..b553a8c99cf29c975f4bd0431fc30c3f919f4707 100644 (file)
                </dict>
                <dict>
                        <key>match</key>
-                       <string>(^|(?&lt;=\s))(&gt;|&gt;=|&gt;bignum|&gt;fixnum|&gt;float|&gt;integer|&lt;|&lt;=|&lt;fp-nan&gt;|\(all-integers\?\)|\(each-integer\)|\(find-integer\)|-|/|/f|/i|/mod|2/|2^|\*|\+|\?1\+|abs|align|all-integers\?|bignum|bignum\?|bit\?|bitand|bitnot|bitor|bits&gt;double|bits&gt;float|bitxor|complex|complex\?|denominator|double&gt;bits|each-integer|even\?|find-integer|find-last-integer-from|fixnum|fixnum\?|float|float&gt;bits|float\?|fp-bitwise=|fp-infinity\?|fp-nan-payload|fp-nan\?|fp-qnan\?|fp-sign|fp-snan\?|fp-special\?|if-zero|imaginary-part|integer|integer&gt;fixnum|integer&gt;fixnum-strict|integer\?|log2|log2-expects-positive|log2-expects-positive\?|mod|neg|neg\?|next-float|next-power-of-2|number|number=|number\?|numerator|odd\?|power-of-2\?|prev-float|ratio|ratio\?|rational|rational\?|real|real-part|real\?|recip|rem|sgn|shift|sq|times|u&gt;|u&gt;=|u&lt;|u&lt;=|unless-zero|unordered\?|when-zero|zero\?)(\s|$)</string>
+                       <string>(^|(?&lt;=\s))(&gt;|&gt;=|&gt;bignum|&gt;fixnum|&gt;float|&gt;integer|&lt;|&lt;=|&lt;fp-nan&gt;|\(all-integers\?\)|\(each-integer\)|\(find-integer\)|-|/|/f|/i|/mod|2/|2^|\*|\+|\?1\+|abs|align|all-integers\?|bignum|bignum\?|bit\?|bitand|bitnot|bitor|bits&gt;double|bits&gt;float|bitxor|complex|complex\?|denominator|double&gt;bits|each-integer|even\?|find-integer|find-last-integer|fixnum|fixnum\?|float|float&gt;bits|float\?|fp-bitwise=|fp-infinity\?|fp-nan-payload|fp-nan\?|fp-qnan\?|fp-sign|fp-snan\?|fp-special\?|if-zero|imaginary-part|integer|integer&gt;fixnum|integer&gt;fixnum-strict|integer\?|log2|log2-expects-positive|log2-expects-positive\?|mod|neg|neg\?|next-float|next-power-of-2|number|number=|number\?|numerator|odd\?|power-of-2\?|prev-float|ratio|ratio\?|rational|rational\?|real|real-part|real\?|recip|rem|sgn|shift|sq|times|u&gt;|u&gt;=|u&lt;|u&lt;=|unless-zero|unordered\?|when-zero|zero\?)(\s|$)</string>
                        <key>name</key>
                        <string>keyword.control.math.factor</string>
                </dict>
index 7d8b18654577a5bbaa7f2f8d6b22a72864857ba8..2673abb4a7ac157ae897eef794577c137186e0c0 100644 (file)
@@ -89,7 +89,7 @@ patterns: [
     name: "keyword.control.combinators.factor"
   }
   {
-    match: "(^|(?<=\\s))(>|>=|>bignum|>fixnum|>float|>integer|<|<=|<fp-nan>|\\(all-integers\\?\\)|\\(each-integer\\)|\\(find-integer\\)|-|/|/f|/i|/mod|2/|2^|\\*|\\+|\\?1\\+|abs|align|all-integers\\?|bignum|bignum\\?|bit\\?|bitand|bitnot|bitor|bits>double|bits>float|bitxor|complex|complex\\?|denominator|double>bits|each-integer|even\\?|find-integer|find-last-integer-from|fixnum|fixnum\\?|float|float>bits|float\\?|fp-bitwise=|fp-infinity\\?|fp-nan-payload|fp-nan\\?|fp-qnan\\?|fp-sign|fp-snan\\?|fp-special\\?|if-zero|imaginary-part|integer|integer>fixnum|integer>fixnum-strict|integer\\?|log2|log2-expects-positive|log2-expects-positive\\?|mod|neg|neg\\?|next-float|next-power-of-2|number|number=|number\\?|numerator|odd\\?|power-of-2\\?|prev-float|ratio|ratio\\?|rational|rational\\?|real|real-part|real\\?|recip|rem|sgn|shift|sq|times|u>|u>=|u<|u<=|unless-zero|unordered\\?|when-zero|zero\\?)(\\s|$)"
+    match: "(^|(?<=\\s))(>|>=|>bignum|>fixnum|>float|>integer|<|<=|<fp-nan>|\\(all-integers\\?\\)|\\(each-integer\\)|\\(find-integer\\)|-|/|/f|/i|/mod|2/|2^|\\*|\\+|\\?1\\+|abs|align|all-integers\\?|bignum|bignum\\?|bit\\?|bitand|bitnot|bitor|bits>double|bits>float|bitxor|complex|complex\\?|denominator|double>bits|each-integer|even\\?|find-integer|find-last-integer|fixnum|fixnum\\?|float|float>bits|float\\?|fp-bitwise=|fp-infinity\\?|fp-nan-payload|fp-nan\\?|fp-qnan\\?|fp-sign|fp-snan\\?|fp-special\\?|if-zero|imaginary-part|integer|integer>fixnum|integer>fixnum-strict|integer\\?|log2|log2-expects-positive|log2-expects-positive\\?|mod|neg|neg\\?|next-float|next-power-of-2|number|number=|number\\?|numerator|odd\\?|power-of-2\\?|prev-float|ratio|ratio\\?|rational|rational\\?|real|real-part|real\\?|recip|rem|sgn|shift|sq|times|u>|u>=|u<|u<=|unless-zero|unordered\\?|when-zero|zero\\?)(\\s|$)"
     name: "keyword.control.math.factor"
   }
   {
index 4a8176766a0a1ab590e1144b03bd93dac954c244..d648dc183fc4e19933d3bd88736ca46037f712d0 100644 (file)
@@ -37,7 +37,7 @@ SynKeywordFactorWord factorWord_io_files | syn keyword factorWord_io_files conta
 SynKeywordFactorWord factorWord_kernel | syn keyword factorWord_kernel contained (clone) -roll -rot -rotd 2bi 2bi* 2bi@ 2curry 2dip 2drop 2dup 2keep 2keepd 2nip 2nipd 2over 2tri 2tri* 2tri@ 2with 3bi 3curry 3dip 3drop 3dup 3keep 3nip 3nipd 3tri 4dip 4drop 4dup 4keep 4nip 5drop 5nip <wrapper> = >boolean ? ?if and assert assert= assert? bi bi* bi-curry bi-curry* bi-curry@ bi@ boa boolean boolean? both? build call callstack callstack>array callstack? clear clone compose composed composed? curried curried? curry die dip do drop dup dupd either? eq? equal? execute get-callstack get-datastack get-retainstack hashcode hashcode* identity-hashcode identity-tuple identity-tuple? if if* keep keepd keepdd loop most new nip nipd not null object or over overd pick pickd prepose reach recursive-hashcode roll rot rotd same? spin swap swapd throw tri tri* tri-curry tri-curry* tri-curry@ tri@ tuck tuple tuple? unless unless* until when when* while while* with wrapper wrapper? xor
 SynKeywordFactorWord factorWord_layouts | syn keyword factorWord_layouts contained (first-bignum) (fixnum-bits) (max-array-capacity) 32-bit? 64-bit? bootstrap-cell bootstrap-cell-bits bootstrap-cells bootstrap-first-bignum bootstrap-fixnum-bits bootstrap-max-array-capacity bootstrap-most-negative-fixnum bootstrap-most-positive-fixnum cell cell-bits cells data-alignment first-bignum fixnum-bits hashcode-shift header-bits immediate immediate? leaf-stack-frame-size max-array-capacity mega-cache-size most-negative-fixnum most-positive-fixnum num-types tag-bits tag-fixnum tag-header tag-mask type-number type-numbers untag-fixnum
 SynKeywordFactorWord factorWord_make | syn keyword factorWord_make contained % %% , ,+ ,, building make
-SynKeywordFactorWord factorWord_math | syn keyword factorWord_math contained (all-integers?) (each-integer) (find-integer) * + - / /f /i /mod 2/ 2^ < <= <fp-nan> > >= >bignum >fixnum >float >fraction >integer >rect ?1+ abs align all-integers? bignum bignum? bit? bitand bitnot bitor bits>double bits>float bitxor complex complex? denominator double>bits each-integer even? find-integer find-last-integer-from fixnum fixnum? float float>bits float? fp-bitwise= fp-infinity? fp-nan-payload fp-nan? fp-qnan? fp-sign fp-snan? fp-special? gcd if-zero imaginary-part integer integer>fixnum integer>fixnum-strict integer? log2 log2-expects-positive log2-expects-positive? mod neg neg? next-float next-power-of-2 number number= number? numerator odd? power-of-2? prev-float ratio ratio? rational rational? real real-part real? recip rect> rem sgn shift simple-gcd sq times u< u<= u> u>= unless-zero unordered? until-zero when-zero zero?
+SynKeywordFactorWord factorWord_math | syn keyword factorWord_math contained (all-integers?) (each-integer) (find-integer) * + - / /f /i /mod 2/ 2^ < <= <fp-nan> > >= >bignum >fixnum >float >fraction >integer >rect ?1+ abs align all-integers? bignum bignum? bit? bitand bitnot bitor bits>double bits>float bitxor complex complex? denominator double>bits each-integer even? find-integer find-last-integer fixnum fixnum? float float>bits float? fp-bitwise= fp-infinity? fp-nan-payload fp-nan? fp-qnan? fp-sign fp-snan? fp-special? gcd if-zero imaginary-part integer integer>fixnum integer>fixnum-strict integer? log2 log2-expects-positive log2-expects-positive? mod neg neg? next-float next-power-of-2 number number= number? numerator odd? power-of-2? prev-float ratio ratio? rational rational? real real-part real? recip rect> rem sgn shift simple-gcd sq times u< u<= u> u>= unless-zero unordered? until-zero when-zero zero?
 SynKeywordFactorWord factorWord_math_order | syn keyword factorWord_math_order contained +eq+ +gt+ +lt+ <=> >=< [-] after=? after? before=? before? between? clamp compare invert-comparison max min
 SynKeywordFactorWord factorWord_memory | syn keyword factorWord_memory contained all-instances compact-gc gc instances minor-gc save save-image save-image-and-exit saving-path size
 SynKeywordFactorWord factorWord_namespaces | syn keyword factorWord_namespaces contained +@ change change-global counter dec get get-global get-namestack global inc init-namestack initialize namespace off on set set-global set-namestack toggle with-global with-scope with-variable with-variable-off with-variable-on with-variables