From 6551068b5d8ef4a873d767bf8561e0be5b91f404 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Mon, 23 Oct 2023 10:44:31 -0700 Subject: [PATCH] sequences: more use of minimum/maximum --- basis/base64/base64.factor | 2 +- basis/compiler/codegen/gc-maps/gc-maps.factor | 2 +- .../propagation/transforms/transforms.factor | 2 +- basis/compression/gzip/gzip.factor | 2 +- .../unix/multiplexers/select/select.factor | 2 +- basis/math/matrices/matrices.factor | 2 +- basis/sequences/windowed/windowed-tests.factor | 2 +- basis/sequences/windowed/windowed.factor | 11 +++++++---- basis/stack-checker/branches/branches.factor | 4 ++-- basis/tools/memory/memory.factor | 4 ++-- core/combinators/combinators.factor | 4 ++-- core/generic/single/single.factor | 2 +- core/sequences/sequences-docs.factor | 18 +++++++++--------- core/sequences/sequences-tests.factor | 2 -- extra/benchmark/benchmark.factor | 2 +- extra/compiler/cfg/gvn/avail/avail.factor | 2 +- extra/crontab/crontab.factor | 4 ++-- extra/google/charts/charts.factor | 2 +- extra/math/distances/distances.factor | 2 +- extra/math/extras/extras-docs.factor | 4 ++-- extra/math/extras/extras.factor | 15 +++++++++------ extra/pdf/layout/layout.factor | 8 ++++---- extra/picomath/picomath-tests.factor | 12 ++++++------ extra/poker/poker.factor | 8 ++++---- extra/project-euler/003/003.factor | 2 +- extra/project-euler/011/011.factor | 2 +- extra/project-euler/026/026.factor | 2 +- extra/project-euler/027/027.factor | 2 +- extra/project-euler/038/038.factor | 2 +- extra/project-euler/042/042.factor | 2 +- extra/project-euler/265/265.factor | 2 +- extra/reports/noise/noise.factor | 4 +--- extra/tetris/tetromino/tetromino.factor | 2 +- 33 files changed, 70 insertions(+), 68 deletions(-) diff --git a/basis/base64/base64.factor b/basis/base64/base64.factor index fb0c460985..abd7023bb3 100644 --- a/basis/base64/base64.factor +++ b/basis/base64/base64.factor @@ -17,7 +17,7 @@ CONSTANT: alphabet $[ ] : alphabet-inverse ( alphabet -- seq ) - dup supremum 1 + f [ + dup maximum 1 + f [ '[ swap _ set-nth ] each-index ] keep ; >> diff --git a/basis/compiler/codegen/gc-maps/gc-maps.factor b/basis/compiler/codegen/gc-maps/gc-maps.factor index abfe6fa6ed..6e278dfe92 100644 --- a/basis/compiler/codegen/gc-maps/gc-maps.factor +++ b/basis/compiler/codegen/gc-maps/gc-maps.factor @@ -20,7 +20,7 @@ SYMBOLS: return-addresses gc-maps ; [ '[ [ t ] dip _ set-nth ] each ] keep ; : largest-spill-slot ( seqs -- n ) - concat [ 0 ] [ supremum 1 + ] if-empty ; + concat [ 0 ] [ maximum 1 + ] if-empty ; : emit-gc-roots ( seqs -- n ) ! seqs is a sequence of sequences of integers 0..n-1 diff --git a/basis/compiler/tree/propagation/transforms/transforms.factor b/basis/compiler/tree/propagation/transforms/transforms.factor index e2c66d018e..3db6b79eb5 100644 --- a/basis/compiler/tree/propagation/transforms/transforms.factor +++ b/basis/compiler/tree/propagation/transforms/transforms.factor @@ -274,7 +274,7 @@ CONSTANT: lookup-table-at-max 256 } 1&& ; : lookup-table-seq ( assoc -- table ) - [ keys supremum 1 + ] keep '[ _ at ] { } map-as ; + [ keys maximum 1 + ] keep '[ _ at ] { } map-as ; : lookup-table-quot ( seq -- newquot ) lookup-table-seq diff --git a/basis/compression/gzip/gzip.factor b/basis/compression/gzip/gzip.factor index 2a432b64a6..c2830f3cc8 100644 --- a/basis/compression/gzip/gzip.factor +++ b/basis/compression/gzip/gzip.factor @@ -208,7 +208,7 @@ TUPLE: deflate-block lit-vec get build-dicts dist-dict set lit-dict set - lit-code-lens supremum 16 < clen-seq supremum 8 < and + lit-code-lens maximum 16 < clen-seq maximum 8 < and [ drop dynamic-headers clen-bits compressed-lens lit-vec get vec-to-codes deflate-block boa ] [ halves [ (compress-dynamic) ] bi@ 2array ] if diff --git a/basis/io/backend/unix/multiplexers/select/select.factor b/basis/io/backend/unix/multiplexers/select/select.factor index bed7901ed6..a6006585bf 100644 --- a/basis/io/backend/unix/multiplexers/select/select.factor +++ b/basis/io/backend/unix/multiplexers/select/select.factor @@ -39,7 +39,7 @@ TUPLE: select-mx < mx read-fdset write-fdset ; [ writes>> keys ] [ write-fdset>> ] bi ; : max-fd ( assoc -- n ) - dup assoc-empty? [ drop 0 ] [ keys supremum ] if ; + dup assoc-empty? [ drop 0 ] [ keys maximum ] if ; : num-fds ( mx -- n ) [ reads>> max-fd ] [ writes>> max-fd ] bi max 1 + ; diff --git a/basis/math/matrices/matrices.factor b/basis/math/matrices/matrices.factor index 573ba45c09..1760c95684 100644 --- a/basis/math/matrices/matrices.factor +++ b/basis/math/matrices/matrices.factor @@ -259,7 +259,7 @@ DEFER: matrix-set-nths : matrix-l-infinity-norm ( m -- n ) dup zero-matrix? [ drop 0 ] [ - [ [ abs ] map-sum ] map supremum + [ [ abs ] map-sum ] map maximum ] if ; inline foldable : matrix-l1-norm ( m -- n ) diff --git a/basis/sequences/windowed/windowed-tests.factor b/basis/sequences/windowed/windowed-tests.factor index 67cc057dc2..0e487e9c12 100644 --- a/basis/sequences/windowed/windowed-tests.factor +++ b/basis/sequences/windowed/windowed-tests.factor @@ -12,4 +12,4 @@ USING: arrays sequences sequences.windowed tools.test ; [ { 1 2 3 4 5 6 } 3 length ] unit-test { { 1 1 1 2 3 4 } } -[ { 1 2 3 4 5 6 } 3 [ infimum ] map ] unit-test +[ { 1 2 3 4 5 6 } 3 [ minimum ] map ] unit-test diff --git a/basis/sequences/windowed/windowed.factor b/basis/sequences/windowed/windowed.factor index 2135ba80bd..81c5048d13 100644 --- a/basis/sequences/windowed/windowed.factor +++ b/basis/sequences/windowed/windowed.factor @@ -38,11 +38,14 @@ M: windowed-sequence length : rolling-median ( seq n -- newseq ) [ median ] rolling-map ; -: rolling-supremum ( seq n -- newseq ) - [ supremum ] rolling-map ; +: rolling-maximum ( seq n -- newseq ) + [ maximum ] rolling-map ; -: rolling-infimum ( seq n -- newseq ) - [ infimum ] rolling-map ; +: rolling-minimum ( seq n -- newseq ) + [ minimum ] rolling-map ; + +ALIAS: rolling-supremum rolling-maximum deprecated +ALIAS: rolling-infimum rolling-minimum deprecated : rolling-count ( ... u n quot: ( ... elt -- ... ? ) -- ... v ) '[ _ count ] rolling-map ; inline diff --git a/basis/stack-checker/branches/branches.factor b/basis/stack-checker/branches/branches.factor index cff080488f..d76e45cbce 100644 --- a/basis/stack-checker/branches/branches.factor +++ b/basis/stack-checker/branches/branches.factor @@ -54,7 +54,7 @@ SYMBOLS: combinator quotations ; : unify-branches ( ins stacks -- in phi-in phi-out ) zip [ 0 { } { } ] [ - [ keys supremum ] [ ] [ balanced? ] tri + [ keys maximum ] [ ] [ balanced? ] tri [ dupd phi-inputs dup phi-outputs ] [ [ combinator get quotations get ] dip simple-unbalanced-branches-error @@ -70,7 +70,7 @@ SYMBOLS: combinator quotations ; : datastack-phi ( seq -- phi-in phi-out ) [ input-count branch-variable ] - [ inner-d-index branch-variable infimum inner-d-index set ] + [ inner-d-index branch-variable minimum inner-d-index set ] [ (meta-d) active-variable ] tri unify-branches [ input-count set ] [ ] [ dup >vector (meta-d) set ] tri* ; diff --git a/basis/tools/memory/memory.factor b/basis/tools/memory/memory.factor index 23b919d306..406291c5c4 100644 --- a/basis/tools/memory/memory.factor +++ b/basis/tools/memory/memory.factor @@ -157,8 +157,8 @@ TUPLE: gc-stats collections times ; [ sum nanos>string ] [ mean >integer nanos>string ] [ median >integer nanos>string ] - [ infimum nanos>string ] - [ supremum nanos>string ] + [ minimum nanos>string ] + [ maximum nanos>string ] } cleave ] bi ] bi diff --git a/core/combinators/combinators.factor b/core/combinators/combinators.factor index 6584655751..b6f33c25c3 100644 --- a/core/combinators/combinators.factor +++ b/core/combinators/combinators.factor @@ -164,13 +164,13 @@ ERROR: no-case object ; : contiguous-range? ( keys -- ? ) dup [ fixnum? ] all? [ dup all-unique? [ - [ length ] [ supremum ] [ infimum ] tri - - 1 = + [ length ] [ maximum ] [ minimum ] tri - - 1 = ] [ drop f ] if ] [ drop f ] if ; : dispatch-case-quot ( default assoc -- quot ) swap [ - [ keys [ infimum ] [ supremum ] bi over ] + [ keys [ minimum ] [ maximum ] bi over ] [ sort-keys values [ >quotation ] map ] bi ] dip dup '[ dup integer? [ diff --git a/core/generic/single/single.factor b/core/generic/single/single.factor index ec901189d5..c331cd3c1f 100644 --- a/core/generic/single/single.factor +++ b/core/generic/single/single.factor @@ -183,7 +183,7 @@ M: echelon-dispatch-engine compile-engine M: tuple-dispatch-engine compile-engine tuple assumed [ echelons>> compile-engines - dup keys supremum 1 + f + dup keys maximum 1 + f swap assoc-union! seq>> ] with-variable ; diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor index cea151ef75..4a210709f2 100644 --- a/core/sequences/sequences-docs.factor +++ b/core/sequences/sequences-docs.factor @@ -1445,18 +1445,18 @@ HELP: product { $values { "seq" { $sequence number } } { "n" number } } { $description "Outputs the product of all elements of " { $snippet "seq" } ". Outputs one given an empty sequence." } ; -HELP: infimum +HELP: minimum { $values { "seq" sequence } { "elt" object } } { $description "Outputs the least element of " { $snippet "seq" } "." } { $examples "Example:" { $example "USING: sequences prettyprint ;" - "{ 1 2 3 4 5 } infimum ." + "{ 1 2 3 4 5 } minimum ." "1" } "Example:" { $example "USING: sequences prettyprint ;" - "{ \"c\" \"b\" \"a\" } infimum ." + "{ \"c\" \"b\" \"a\" } minimum ." "\"a\"" } } @@ -1477,18 +1477,18 @@ HELP: infimum-by } { $errors "Throws an error if the sequence is empty." } ; -HELP: supremum +HELP: maximum { $values { "seq" sequence } { "elt" object } } { $description "Outputs the greatest element of " { $snippet "seq" } "." } { $examples "Example:" { $example "USING: sequences prettyprint ;" - "{ 1 2 3 4 5 } supremum ." + "{ 1 2 3 4 5 } maximum ." "5" } "Example:" { $example "USING: sequences prettyprint ;" - "{ \"c\" \"b\" \"a\" } supremum ." + "{ \"c\" \"b\" \"a\" } maximum ." "\"c\"" } } @@ -1509,7 +1509,7 @@ HELP: supremum-by } { $errors "Throws an error if the sequence is empty." } ; -{ min max infimum infimum-by supremum supremum-by } related-words +{ min max minimum infimum-by maximum supremum-by } related-words HELP: shortest { $values { "seqs" sequence } { "elt" object } } @@ -2167,9 +2167,9 @@ ARTICLE: "sequences-combinators" "Sequence combinators" } "Superlatives with " { $link min } " and " { $link max } ":" { $subsections - infimum + minimum infimum-by - supremum + maximum supremum-by shorter longer diff --git a/core/sequences/sequences-tests.factor b/core/sequences/sequences-tests.factor index 019c303064..8b224f37cc 100644 --- a/core/sequences/sequences-tests.factor +++ b/core/sequences/sequences-tests.factor @@ -390,8 +390,6 @@ M: bogus-hashcode hashcode* 2drop 0 >bignum ; { 24 } [ { 1 2 } { 3 4 } [ + ] [ * ] 2map-reduce ] unit-test { 2 96 } [ 2 { 3 3 3 3 } { 4 4 4 4 } [ [ dup ] 2dip * * ] [ + ] 2map-reduce ] unit-test -{ 4 } [ 5 supremum ] unit-test -{ 0 } [ 5 infimum ] unit-test { 4 } [ 5 maximum ] unit-test { 0 } [ 5 minimum ] unit-test diff --git a/extra/benchmark/benchmark.factor b/extra/benchmark/benchmark.factor index 36c10f35ca..9fdce4715f 100644 --- a/extra/benchmark/benchmark.factor +++ b/extra/benchmark/benchmark.factor @@ -9,7 +9,7 @@ IN: benchmark SYMBOL: benchmarks-disabled? : run-timing-benchmark ( vocab -- time ) - 5 swap '[ gc [ _ run ] benchmark ] replicate infimum ; + 5 swap '[ gc [ _ run ] benchmark ] replicate minimum ; : run-profile-benchmark ( vocab -- profile ) compact-gc '[ _ run ] profile most-recent-profile-data ; diff --git a/extra/compiler/cfg/gvn/avail/avail.factor b/extra/compiler/cfg/gvn/avail/avail.factor index c73eacd881..c7369afdeb 100644 --- a/extra/compiler/cfg/gvn/avail/avail.factor +++ b/extra/compiler/cfg/gvn/avail/avail.factor @@ -19,7 +19,7 @@ M: avail transfer-set drop defined assoc-union ; : available? ( vn -- ? ) basic-block get avail-in key? ; : best-vreg ( available-vregs -- vreg ) - [ f ] [ infimum ] if-empty ; + [ f ] [ minimum ] if-empty ; : >avail-vreg ( vreg -- vreg/f ) final-iteration? get [ diff --git a/extra/crontab/crontab.factor b/extra/crontab/crontab.factor index 16a6ed75a3..08164ddef0 100644 --- a/extra/crontab/crontab.factor +++ b/extra/crontab/crontab.factor @@ -56,7 +56,7 @@ CONSTANT: aliases H{ [ [ days>> 1 ] [ months>> ] bi [ { 0 31 29 31 30 31 30 31 31 30 31 30 31 } nth - ] map supremum [ between? ] 2curry all? + ] map maximum [ between? ] 2curry all? ] [ minutes>> [ 0 59 between? ] all? ] [ hours>> [ 0 23 between? ] all? ] @@ -200,4 +200,4 @@ ALIAS: crons-today crons-this-day [ rfc822>timestamp timestamp>unix-time ] map-keys ; : grouped-crons. ( assoc -- ) - keys-unix-to-rfc822 [ first2 [ write bl ] [ ... ] bi* ] each ; \ No newline at end of file + keys-unix-to-rfc822 [ first2 [ write bl ] [ ... ] bi* ] each ; diff --git a/extra/google/charts/charts.factor b/extra/google/charts/charts.factor index 72830602fc..90e6870902 100644 --- a/extra/google/charts/charts.factor +++ b/extra/google/charts/charts.factor @@ -25,7 +25,7 @@ background foreground margin bar-width ; : chd ( chart seq -- chart ) [ x,y >>data ] [ - [ infimum 0 min ] [ supremum 0 max ] bi 2array + [ minimum 0 min ] [ maximum 0 max ] bi 2array x,y >>data-scale ] bi ; diff --git a/extra/math/distances/distances.factor b/extra/math/distances/distances.factor index a54035a424..42815ed616 100644 --- a/extra/math/distances/distances.factor +++ b/extra/math/distances/distances.factor @@ -19,7 +19,7 @@ IN: math.distances 1 minkowski-distance ; : chebyshev-distance ( a b -- n ) ! also chessboard-distance - v- vabs supremum ; + v- vabs maximum ; : cosine-distance ( a b -- n ) cosine-similarity 1 swap - ; diff --git a/extra/math/extras/extras-docs.factor b/extra/math/extras/extras-docs.factor index 5a462fbbce..e12dce7297 100644 --- a/extra/math/extras/extras-docs.factor +++ b/extra/math/extras/extras-docs.factor @@ -48,11 +48,11 @@ HELP: nan-sum HELP: nan-min { $values { "seq" sequence } { "n" number } } -{ $description "Return the " { $link infimum } " of " { $snippet "seq" } " ignoring any NaNs." } ; +{ $description "Return the " { $link minimum } " of " { $snippet "seq" } " ignoring any NaNs." } ; HELP: nan-max { $values { "seq" sequence } { "n" number } } -{ $description "Return the " { $link supremum } " of " { $snippet "seq" } " ignoring any NaNs." } ; +{ $description "Return the " { $link maximum } " of " { $snippet "seq" } " ignoring any NaNs." } ; HELP: sinc { $values { "x" number } { "y" number } } diff --git a/extra/math/extras/extras.factor b/extra/math/extras/extras.factor index 8d246bbefe..eb89c37697 100644 --- a/extra/math/extras/extras.factor +++ b/extra/math/extras/extras.factor @@ -106,11 +106,14 @@ PRIVATE> : moving-median ( u n -- v ) [ median ] map ; -: moving-supremum ( u n -- v ) - [ supremum ] map ; +: moving-maximum ( u n -- v ) + [ maximum ] map ; -: moving-infimum ( u n -- v ) - [ infimum ] map ; +: moving-minimum ( u n -- v ) + [ minimum ] map ; + +ALIAS: moving-supremum moving-maximum deprecated +ALIAS: moving-infimum moving-minimum deprecated : moving-sum ( u n -- v ) [ sum ] map ; @@ -152,10 +155,10 @@ PRIVATE> 0 [ dup fp-nan? [ drop ] [ + ] if ] binary-reduce ; : nan-min ( seq -- n ) - [ fp-nan? ] reject infimum ; + [ fp-nan? ] reject minimum ; : nan-max ( seq -- n ) - [ fp-nan? ] reject supremum ; + [ fp-nan? ] reject maximum ; : fill-nans ( seq -- newseq ) [ first ] keep [ diff --git a/extra/pdf/layout/layout.factor b/extra/pdf/layout/layout.factor index b9c8bac3fa..c357f43311 100644 --- a/extra/pdf/layout/layout.factor +++ b/extra/pdf/layout/layout.factor @@ -77,7 +77,7 @@ M: div pdf-render M: div pdf-width [ style>> set-style ] keep - items>> [ dupd pdf-width ] map nip supremum ; + items>> [ dupd pdf-width ] map nip maximum ; > set-style ] keep [ font>> ] [ string>> ] bi* split-lines - [ dupd text-width ] map nip supremum ; + [ dupd text-width ] map nip maximum ; TUPLE: text string style ; @@ -141,7 +141,7 @@ M: text pdf-render M: text pdf-width [ style>> set-style ] keep [ font>> ] [ string>> ] bi* split-lines - [ dupd text-width ] map nip supremum ; + [ dupd text-width ] map nip maximum ; TUPLE: hr width ; @@ -242,7 +242,7 @@ M: table-row pdf-render [ [ contents>> [ 0 ] [ - [ [ dupd pdf-width ] [ 0 ] if* ] map supremum + [ [ dupd pdf-width ] [ 0 ] if* ] map maximum ] if-empty ] [ 0 ] if* ] map nip ; diff --git a/extra/picomath/picomath-tests.factor b/extra/picomath/picomath-tests.factor index 9bcc974136..f05947af04 100644 --- a/extra/picomath/picomath-tests.factor +++ b/extra/picomath/picomath-tests.factor @@ -14,7 +14,7 @@ IN: picomath { 0.5 0.520499877813 } { 2.1 0.997020533344 } } [ [ first erf ] [ second - ] bi abs ] map - supremum 1e-6 < + maximum 1e-6 < ] unit-test { t } [ @@ -25,7 +25,7 @@ IN: picomath { $[ 1e-5 1e-8 + ] 0.00001001005010021717 } { 0.5 0.6487212707001282 } } [ [ first expm1 ] [ second - ] bi abs ] map - supremum 1e-6 < + maximum 1e-6 < ] unit-test { t } [ @@ -36,7 +36,7 @@ IN: picomath { 0.5 0.691462461274 } { 2.1 0.982135579437 } } [ [ first phi ] [ second - ] bi abs ] map - supremum 1e-3 < + maximum 1e-3 < ] unit-test : factorial ( n -- n! ) [ 1 ] [ [1..b] 1 [ * ] reduce ] if-zero ; @@ -44,7 +44,7 @@ IN: picomath { t } [ { 0 1 10 100 1000 10000 } [ [ factorial log ] [ log-factorial ] bi - abs - ] map supremum 1e-6 < + ] map maximum 1e-6 < ] unit-test : relative-error ( approx value -- relative-error ) @@ -64,7 +64,7 @@ IN: picomath { 12.001 40014424.1571 } { 15.2 149037380723.0 } } [ [ first gamma ] [ second relative-error ] bi ] map - supremum 1e-6 < + maximum 1e-6 < ] unit-test { t } [ @@ -79,5 +79,5 @@ IN: picomath { 12.0001 17.5025521125 } { 27.4 62.5755868211 } } [ [ first log-gamma ] [ second relative-error ] bi ] map - supremum 1e-10 < + maximum 1e-10 < ] unit-test diff --git a/extra/poker/poker.factor b/extra/poker/poker.factor index 9eb2c7ca9a..2c4939d919 100644 --- a/extra/poker/poker.factor +++ b/extra/poker/poker.factor @@ -150,7 +150,7 @@ PRIVATE> : best-holdem-hand ( hand -- n cards ) 5 [ [ hand-value ] [ ] bi ] { } map>assoc-combinations - infimum first2 ; + minimum first2 ; : value>string ( n -- string ) value>rank VALUES nth ; @@ -185,7 +185,7 @@ ERROR: no-card card deck ; n [ holes deck 5 sample '[ [ _ append best-holdem-hand drop ] keep - ] { } map>assoc infimum second + ] { } map>assoc minimum second ] replicate histogram ; : (best-omaha-hand) ( seq -- pair ) @@ -193,13 +193,13 @@ ERROR: no-card card deck ; [ 2 all-combinations ] [ 3 all-combinations ] bi* 2array [ concat [ best-holdem-hand drop ] keep ] { } product-map>assoc ; -: best-omaha-hand ( seq -- n cards ) (best-omaha-hand) infimum first2 ; +: best-omaha-hand ( seq -- n cards ) (best-omaha-hand) minimum first2 ; :: compare-omaha-hands ( holes deck n -- seq ) n [ holes deck 5 sample '[ [ _ append best-omaha-hand drop ] keep - ] { } map>assoc infimum second + ] { } map>assoc minimum second ] replicate histogram ; ERROR: bad-suit-symbol ch ; diff --git a/extra/project-euler/003/003.factor b/extra/project-euler/003/003.factor index f04c15cefc..78498049c4 100644 --- a/extra/project-euler/003/003.factor +++ b/extra/project-euler/003/003.factor @@ -17,7 +17,7 @@ IN: project-euler.003 ! -------- : euler003 ( -- answer ) - 600851475143 factors supremum ; + 600851475143 factors maximum ; ! [ euler003 ] 100 ave-time ! 1 ms ave run time - 0.49 SD (100 trials) diff --git a/extra/project-euler/011/011.factor b/extra/project-euler/011/011.factor index b0512ea4e4..451b809468 100644 --- a/extra/project-euler/011/011.factor +++ b/extra/project-euler/011/011.factor @@ -97,7 +97,7 @@ PRIVATE> [ { [ horizontal ] [ vertical ] [ diagonal/ ] [ diagonal\ ] } [ call( -- matrix ) 4 max-product , ] each - ] { } make supremum ; + ] { } make maximum ; ! [ euler011 ] 100 ave-time ! 3 ms ave run time - 0.77 SD (100 trials) diff --git a/extra/project-euler/026/026.factor b/extra/project-euler/026/026.factor index c44a74a6cb..743d31ada1 100644 --- a/extra/project-euler/026/026.factor +++ b/extra/project-euler/026/026.factor @@ -57,7 +57,7 @@ PRIVATE> diff --git a/extra/project-euler/027/027.factor b/extra/project-euler/027/027.factor index 2e5efbfb8f..5f174e19ca 100644 --- a/extra/project-euler/027/027.factor +++ b/extra/project-euler/027/027.factor @@ -60,7 +60,7 @@ IN: project-euler.027 swap 0 (consecutive-primes) ; : max-consecutive ( seq -- elt n ) - dup [ first2 consecutive-primes ] map dup supremum + dup [ first2 consecutive-primes ] map dup maximum over index [ swap nth ] curry bi@ ; PRIVATE> diff --git a/extra/project-euler/038/038.factor b/extra/project-euler/038/038.factor index ceffdec347..b1fad75822 100644 --- a/extra/project-euler/038/038.factor +++ b/extra/project-euler/038/038.factor @@ -50,7 +50,7 @@ IN: project-euler.038 PRIVATE> : euler038 ( -- answer ) - 9123 9876 [a..b] [ concat-product ] map [ pandigital? ] filter supremum ; + 9123 9876 [a..b] [ concat-product ] map [ pandigital? ] filter maximum ; ! [ euler038 ] 100 ave-time ! 11 ms ave run time - 1.5 SD (100 trials) diff --git a/extra/project-euler/042/042.factor b/extra/project-euler/042/042.factor index fbf1c01e3e..2b03197a0a 100644 --- a/extra/project-euler/042/042.factor +++ b/extra/project-euler/042/042.factor @@ -47,7 +47,7 @@ IN: project-euler.042 PRIVATE> : euler042 ( -- answer ) - source-042 [ alpha-value ] map dup supremum + source-042 [ alpha-value ] map dup maximum triangle-upto [ member? ] curry count ; ! [ euler042 ] 100 ave-time diff --git a/extra/project-euler/265/265.factor b/extra/project-euler/265/265.factor index 1bda3e4e6b..a672a68f09 100644 --- a/extra/project-euler/265/265.factor +++ b/extra/project-euler/265/265.factor @@ -45,7 +45,7 @@ CONSTANT: N 5 : ?register ( acc seq -- ) complete rotate-bits - dup [ 2 N ^ mod ] map all-unique? [ infimum swap push ] [ 2drop ] if ; + dup [ 2 N ^ mod ] map all-unique? [ minimum swap push ] [ 2drop ] if ; : add-bit ( seen bit -- seen' t/f ) over last 2 * + 2 N ^ mod diff --git a/extra/reports/noise/noise.factor b/extra/reports/noise/noise.factor index 9dccb37a3e..33f269e254 100644 --- a/extra/reports/noise/noise.factor +++ b/extra/reports/noise/noise.factor @@ -133,9 +133,7 @@ M: lambda-word word-noise-factor vocab-words flatten-generics [ word-noise-factor dup 20 < [ drop 0 ] when ] map [ 0 ] [ - [ [ sum ] [ length 5 max ] bi /i ] - [ supremum ] - bi + + [ [ sum ] [ length 5 max ] bi /i ] [ maximum ] bi + ] if-empty ; : noisy-vocabs ( -- alist ) diff --git a/extra/tetris/tetromino/tetromino.factor b/extra/tetris/tetromino/tetromino.factor index 3bfc0dc0f3..f207b39279 100644 --- a/extra/tetris/tetromino/tetromino.factor +++ b/extra/tetris/tetromino/tetromino.factor @@ -105,7 +105,7 @@ SYMBOL: tetrominoes tetrominoes get random ; : blocks-max ( blocks quot -- max ) - map supremum 1 + ; inline + map maximum 1 + ; inline : blocks-width ( blocks -- width ) [ first ] blocks-max ; -- 2.34.1