From a7759f3d39b62e3da1d69a0e96ab7b384cdd3efa Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 29 Dec 2021 21:18:16 -0600 Subject: [PATCH] factor: use new math.ranges syntax in tests and docs --- basis/bootstrap/assembler/ppc.32.linux.factor | 2 +- basis/bootstrap/assembler/ppc.64.linux.factor | 2 +- basis/bootstrap/assembler/ppc.factor | 4 ++-- basis/calendar/calendar-tests.factor | 4 ++-- .../cfg/dominance/dominance-tests.factor | 4 ++-- basis/cpu/ppc/ppc.factor | 4 ++-- basis/html/templates/chloe/chloe-docs.factor | 2 +- .../tessellation/tessellation-tests.factor | 4 ++-- basis/math/primes/erato/erato-tests.factor | 2 +- basis/math/vectors/simd/simd-tests.factor | 2 +- .../hashtables/hashtables-tests.factor | 2 +- basis/random/passwords/passwords.factor | 8 ++++---- basis/windows/user32/user32.factor | 2 +- extra/backtrack/backtrack-docs.factor | 4 ++-- extra/bittorrent/bittorrent.factor | 6 +++--- extra/hashcash/hashcash.factor | 2 +- extra/imap/imap-tests.factor | 2 +- extra/math/factorials/factorials-tests.factor | 2 +- extra/pcre/pcre-tests.factor | 2 +- extra/trees/trees-tests.factor | 18 +++++++++--------- 20 files changed, 39 insertions(+), 39 deletions(-) diff --git a/basis/bootstrap/assembler/ppc.32.linux.factor b/basis/bootstrap/assembler/ppc.32.linux.factor index a9f55b6a16..da83cef08d 100644 --- a/basis/bootstrap/assembler/ppc.32.linux.factor +++ b/basis/bootstrap/assembler/ppc.32.linux.factor @@ -16,7 +16,7 @@ CONSTANT: rs-reg 15 CONSTANT: vm-reg 16 CONSTANT: ctx-reg 17 CONSTANT: frame-reg 31 -: nv-int-regs ( -- seq ) 13 31 [a,b] ; +: nv-int-regs ( -- seq ) 13 31 [a..b] ; : LOAD32 ( r n -- ) [ -16 shift 0xffff bitand LIS ] diff --git a/basis/bootstrap/assembler/ppc.64.linux.factor b/basis/bootstrap/assembler/ppc.64.linux.factor index 831b95b7eb..9ec4d37373 100644 --- a/basis/bootstrap/assembler/ppc.64.linux.factor +++ b/basis/bootstrap/assembler/ppc.64.linux.factor @@ -16,7 +16,7 @@ CONSTANT: rs-reg 15 CONSTANT: vm-reg 16 CONSTANT: ctx-reg 17 CONSTANT: frame-reg 31 -: nv-int-regs ( -- seq ) 13 31 [a,b] ; +: nv-int-regs ( -- seq ) 13 31 [a..b] ; : LOAD64 ( r n -- ) [ dup ] dip { diff --git a/basis/bootstrap/assembler/ppc.factor b/basis/bootstrap/assembler/ppc.factor index 09bbe19d57..3f45aba7f6 100644 --- a/basis/bootstrap/assembler/ppc.factor +++ b/basis/bootstrap/assembler/ppc.factor @@ -40,8 +40,8 @@ IN: bootstrap.ppc : restore-vec ( reg offt -- ) save-at 11 swap LI 11 1 LVXL ; ! Stop using intervals here. -: nv-fp-regs ( -- seq ) 14 31 [a,b] ; -: nv-vec-regs ( -- seq ) 20 31 [a,b] ; +: nv-fp-regs ( -- seq ) 14 31 [a..b] ; +: nv-vec-regs ( -- seq ) 20 31 [a..b] ; : saved-fp-regs-size ( -- n ) 144 ; : saved-vec-regs-size ( -- n ) 192 ; diff --git a/basis/calendar/calendar-tests.factor b/basis/calendar/calendar-tests.factor index 4127e122a9..ec90ce8afb 100644 --- a/basis/calendar/calendar-tests.factor +++ b/basis/calendar/calendar-tests.factor @@ -251,14 +251,14 @@ IN: calendar ] unit-test { t } [ - 1999 2025 [a,b] [ + 1999 2025 [a..b] [ timestamp>year-dates-gmt [ >date< ymd>ordinal ] map [ < ] monotonic? ] map [ ] all? ] unit-test { t } [ - 1999 2025 [a,b] [ + 1999 2025 [a..b] [ timestamp>year-dates-gmt [ >date< ymd>ordinal ] map [ < ] monotonic? ] map [ ] all? diff --git a/basis/compiler/cfg/dominance/dominance-tests.factor b/basis/compiler/cfg/dominance/dominance-tests.factor index d963c96140..66cb3211a8 100644 --- a/basis/compiler/cfg/dominance/dominance-tests.factor +++ b/basis/compiler/cfg/dominance/dominance-tests.factor @@ -52,7 +52,7 @@ V{ } 4 test-bb { } [ test-dominance ] unit-test -{ t } [ 0 4 [a,b] [ get dom-parent 0 get eq? ] all? ] unit-test +{ t } [ 0 4 [a..b] [ get dom-parent 0 get eq? ] all? ] unit-test ! The other example from the paper V{ } 0 test-bb @@ -71,7 +71,7 @@ V{ } 5 test-bb { } [ test-dominance ] unit-test -{ t } [ 0 5 [a,b] [ get dom-parent 0 get eq? ] all? ] unit-test +{ t } [ 0 5 [a..b] [ get dom-parent 0 get eq? ] all? ] unit-test : non-det-test ( -- cfg ) 9 [ V{ } clone over insns>block ] { } map>assoc dup diff --git a/basis/cpu/ppc/ppc.factor b/basis/cpu/ppc/ppc.factor index 7a78d3d981..24d09fb8b3 100644 --- a/basis/cpu/ppc/ppc.factor +++ b/basis/cpu/ppc/ppc.factor @@ -46,8 +46,8 @@ CONSTANT: vm-reg 16 M: ppc machine-registers { - { int-regs $[ 3 12 [a,b] 17 29 [a,b] append ] } - { float-regs $[ 0 29 [a,b] ] } + { int-regs $[ 3 12 [a..b] 17 29 [a..b] append ] } + { float-regs $[ 0 29 [a..b] ] } } ; M: ppc frame-reg 31 ; diff --git a/basis/html/templates/chloe/chloe-docs.factor b/basis/html/templates/chloe/chloe-docs.factor index c38cf0ac4c..94b0a9c7d1 100644 --- a/basis/html/templates/chloe/chloe-docs.factor +++ b/basis/html/templates/chloe/chloe-docs.factor @@ -256,7 +256,7 @@ $nl " random-attrs string>random-generator" " '[" " _ _ _" - " [ [a,b] random present write ]" + " [ [a..b] random present write ]" " with-random-generator" " ] [code] ;" } diff --git a/basis/images/tessellation/tessellation-tests.factor b/basis/images/tessellation/tessellation-tests.factor index 74b9d1b146..211f5893ee 100644 --- a/basis/images/tessellation/tessellation-tests.factor +++ b/basis/images/tessellation/tessellation-tests.factor @@ -20,7 +20,7 @@ IN: images.tessellation } } [ - 1 16 [a,b] >byte-array >>bitmap + 1 16 [a..b] >byte-array >>bitmap { 4 4 } >>dim L >>component-order ubyte-components >>component-type @@ -40,7 +40,7 @@ IN: images.tessellation } } [ - 1 9 [a,b] >byte-array >>bitmap + 1 9 [a..b] >byte-array >>bitmap { 3 3 } >>dim L >>component-order ubyte-components >>component-type diff --git a/basis/math/primes/erato/erato-tests.factor b/basis/math/primes/erato/erato-tests.factor index 96a2cfdb20..c68b35b655 100644 --- a/basis/math/primes/erato/erato-tests.factor +++ b/basis/math/primes/erato/erato-tests.factor @@ -13,7 +13,7 @@ math.ranges sequences tools.test ; ! Check sieve array length logic by making sure we get the right ! end-point for numbers with all possibilities mod 30. If something ! were to go wrong, we'd get a bounds-error. -{ } [ 2 100 [a,b] [ dup sieve marked-prime? drop ] each ] unit-test +{ } [ 2 100 [a..b] [ dup sieve marked-prime? drop ] each ] unit-test { t } [ { 2 3 5 7 11 13 } 100 sieve '[ _ marked-prime? ] all? diff --git a/basis/math/vectors/simd/simd-tests.factor b/basis/math/vectors/simd/simd-tests.factor index 9f4a17e64e..c137e37203 100644 --- a/basis/math/vectors/simd/simd-tests.factor +++ b/basis/math/vectors/simd/simd-tests.factor @@ -481,7 +481,7 @@ simd-classes [ _ [ [ _ new [ [ length ] keep like ] - [ [ length dup dup + [a,b) ] keep like ] bi [ ] 2sequence + [ [ length dup dup + [a..b) ] keep like ] bi [ ] 2sequence ] dip '[ _ vshuffle2-elements ] ] [ = ] check-optimizer ] unit-test diff --git a/basis/persistent/hashtables/hashtables-tests.factor b/basis/persistent/hashtables/hashtables-tests.factor index 9fcd4de9b9..3f42003e89 100644 --- a/basis/persistent/hashtables/hashtables-tests.factor +++ b/basis/persistent/hashtables/hashtables-tests.factor @@ -82,7 +82,7 @@ M: hash-0-b hashcode* 2drop 0 ; : random-string ( -- str ) 1000000 random ; - ! [ CHAR: a CHAR: z [a,b] random ] "" replicate-as ; + ! [ CHAR: a CHAR: z [a..b] random ] "" replicate-as ; : random-assocs ( n -- hash phash ) [ random-string ] replicate diff --git a/basis/random/passwords/passwords.factor b/basis/random/passwords/passwords.factor index 44cd127efd..61cc31c188 100644 --- a/basis/random/passwords/passwords.factor +++ b/basis/random/passwords/passwords.factor @@ -5,12 +5,12 @@ IN: random.passwords diff --git a/basis/windows/user32/user32.factor b/basis/windows/user32/user32.factor index 06b9f284fb..641c1f06ca 100644 --- a/basis/windows/user32/user32.factor +++ b/basis/windows/user32/user32.factor @@ -2366,7 +2366,7 @@ FUNCTION: BOOL IsValidDpiAwarenessContext ( ) ! DPI_AWARENESS_CONTEXT experimentally: -! USE: math.ranges -100 1000 [a,b] [ IsValidDpiAwarenessContext ] zip-with +! USE: math.ranges -100 1000 [a..b] [ IsValidDpiAwarenessContext ] zip-with ! [ nip 0 > ] assoc-filter keys . ! { -5 -4 -3 -2 -1 17 18 34 273 529 785 } diff --git a/extra/backtrack/backtrack-docs.factor b/extra/backtrack/backtrack-docs.factor index 573864ec34..f4efda5a0b 100644 --- a/extra/backtrack/backtrack-docs.factor +++ b/extra/backtrack/backtrack-docs.factor @@ -21,7 +21,7 @@ $nl " [ + 30 = ] [ 4 * swap 2 * + 74 = ] 2bi and ;" "" "[" - " 1 30 [a,b] amb 1 30 [a,b] amb" + " 1 30 [a..b] amb 1 30 [a..b] amb" " [ check must-be-true ] [ 2array ] 2bi" "] bag-of ." "V{ { 23 7 } }" @@ -32,7 +32,7 @@ $nl " [ + 30 = ] [ 4 * swap 2 * + 74 = ] 2bi and ;" "" "[" - " 1 30 [a,b] amb 1 30 [a,b] amb" + " 1 30 [a..b] amb 1 30 [a..b] amb" " 2dup check must-be-true" " \"%d chickens, %d cows\\n\" printf" " t" diff --git a/extra/bittorrent/bittorrent.factor b/extra/bittorrent/bittorrent.factor index 3f606fb43f..70e4158e7b 100644 --- a/extra/bittorrent/bittorrent.factor +++ b/extra/bittorrent/bittorrent.factor @@ -15,9 +15,9 @@ IN: bittorrent << CONSTANT: ALPHANUMERIC $[ [ - CHAR: a CHAR: z [a,b] % - CHAR: A CHAR: Z [a,b] % - CHAR: 0 CHAR: 9 [a,b] % + CHAR: a CHAR: z [a..b] % + CHAR: A CHAR: Z [a..b] % + CHAR: 0 CHAR: 9 [a..b] % ".-_~" % ] { } make ] diff --git a/extra/hashcash/hashcash.factor b/extra/hashcash/hashcash.factor index b0f7efc274..017cb4bcd0 100644 --- a/extra/hashcash/hashcash.factor +++ b/extra/hashcash/hashcash.factor @@ -25,7 +25,7 @@ IN: hashcash ! Random salt is formed by ascii characters ! between 33 and 126 CONSTANT: available-chars $[ - CHAR: : 33 126 [a,b] remove >byte-array + CHAR: : 33 126 [a..b] remove >byte-array ] PRIVATE> diff --git a/extra/imap/imap-tests.factor b/extra/imap/imap-tests.factor index 41f160be04..d9b7231c7b 100644 --- a/extra/imap/imap-tests.factor +++ b/extra/imap/imap-tests.factor @@ -7,7 +7,7 @@ FROM: pcre => findall ; IN: imap.tests : random-ascii ( n -- str ) - [ CHAR: a CHAR: z [a,b] random ] "" replicate-as ; + [ CHAR: a CHAR: z [a..b] random ] "" replicate-as ; : make-mail ( from -- mail ) now timestamp>rfc822 swap 10000 random diff --git a/extra/math/factorials/factorials-tests.factor b/extra/math/factorials/factorials-tests.factor index dcfea2f5d1..b2a06d8efa 100644 --- a/extra/math/factorials/factorials-tests.factor +++ b/extra/math/factorials/factorials-tests.factor @@ -14,7 +14,7 @@ USING: kernel math.factorials math.functions math.ranges sequences tools.test ; 1/0. 1/105 1/0. -1/15 1/0. 1/3 1/0. -1 1/0. 1 1 1 2 3 8 15 48 105 384 945 3840 } -} [ -10 10 [a,b] [ double-factorial ] map ] unit-test +} [ -10 10 [a..b] [ double-factorial ] map ] unit-test { 1 } [ 10 10 factorial/ ] unit-test { 720 } [ 10 7 factorial/ ] unit-test diff --git a/extra/pcre/pcre-tests.factor b/extra/pcre/pcre-tests.factor index 686d93e772..abadc761c0 100644 --- a/extra/pcre/pcre-tests.factor +++ b/extra/pcre/pcre-tests.factor @@ -90,7 +90,7 @@ os unix? [ [ 10 ] [ PCRE_CONFIG_NEWLINE pcre-config ] unit-test ] when ] unit-test : long-string ( -- x ) - 10000 [ CHAR: a CHAR: z [a,b] random ] "" replicate-as ; + 10000 [ CHAR: a CHAR: z [a..b] random ] "" replicate-as ; ! Performance { 0 } [ long-string ".{0,15}foobar.{0,10}" findall length ] unit-test diff --git a/extra/trees/trees-tests.factor b/extra/trees/trees-tests.factor index fa1768aadc..4a989406ac 100644 --- a/extra/trees/trees-tests.factor +++ b/extra/trees/trees-tests.factor @@ -113,22 +113,22 @@ CONSTANT: test-tree2 TREE{ { f } [ 99 test-tree2 lower-node ] unit-test { f } [ 100 test-tree2 lower-node ] unit-test -100 121 (a,b] [ +100 121 (a..b] [ [ test-tree2-lower-key 1array ] keep [ test-tree2 lower-node key>> ] curry unit-test ] each -99 120 [a,b) [ +99 120 [a..b) [ [ test-tree2-higher-key 1array ] keep [ test-tree2 higher-node key>> ] curry unit-test ] each { f } [ 120 test-tree2 higher-node ] unit-test { f } [ 121 test-tree2 higher-node ] unit-test { f } [ 99 test-tree2 floor-node ] unit-test -100 121 [a,b] [ +100 121 [a..b] [ [ test-tree2-floor-key 1array ] keep [ test-tree2 floor-node key>> ] curry unit-test ] each -99 120 [a,b] [ +99 120 [a..b] [ [ test-tree2-ceiling-key 1array ] keep [ test-tree2 ceiling-node key>> ] curry unit-test ] each { f } [ 121 test-tree2 ceiling-node ] unit-test @@ -164,10 +164,10 @@ CONSTANT: test-tree2 TREE{ : ?a,b? ( a b ? ? -- range ) 2array { - { { t t } [ [a,b] ] } - { { t f } [ [a,b) ] } - { { f t } [ (a,b] ] } - { { f f } [ (a,b) ] } + { { t t } [ [a..b] ] } + { { t f } [ [a..b) ] } + { { f t } [ (a..b] ] } + { { f f } [ (a..b) ] } } case ; ! subtree>alist @@ -182,7 +182,7 @@ CONSTANT: test-tree2 TREE{ { { f f } [ subtree>alist() ] } } case ; -99 121 [a,b] 2 all-combinations +99 121 [a..b] 2 all-combinations { t f } dup 2array 2array [ first2 [ first2 ] bi@ { -- 2.34.1