From 1ee8c8f5eb05bc9be177d2a45079f47cd5a814ac Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 29 Oct 2009 14:34:04 -0500 Subject: [PATCH] sigma -> map-sum --- basis/compiler/cfg/builder/builder-tests.factor | 2 +- basis/compiler/cfg/gc-checks/gc-checks.factor | 4 ++-- basis/fry/fry.factor | 2 +- basis/math/primes/erato/erato-tests.factor | 2 +- basis/math/statistics/statistics.factor | 4 ++-- basis/pack/pack.factor | 2 +- basis/roman/roman.factor | 2 +- basis/tools/profiler/profiler.factor | 2 +- basis/ui/gadgets/paragraphs/paragraphs.factor | 4 ++-- core/classes/tuple/tuple.factor | 2 +- core/sequences/sequences-docs.factor | 5 ++--- core/sequences/sequences-tests.factor | 2 +- core/sequences/sequences.factor | 4 ++-- extra/benchmark/backtrack/backtrack.factor | 6 +++--- extra/benchmark/e-ratios/e-ratios.factor | 2 +- extra/benchmark/tuple-arrays/tuple-arrays.factor | 4 ++-- extra/project-euler/021/021.factor | 2 +- extra/project-euler/028/028.factor | 2 +- extra/project-euler/030/030.factor | 2 +- extra/project-euler/034/034.factor | 2 +- extra/project-euler/043/043.factor | 2 +- extra/project-euler/048/048.factor | 2 +- extra/project-euler/053/053.factor | 2 +- extra/project-euler/063/063.factor | 2 +- extra/project-euler/072/072.factor | 2 +- extra/project-euler/074/074.factor | 2 +- extra/project-euler/092/092.factor | 2 +- extra/project-euler/116/116.factor | 2 +- extra/project-euler/190/190.factor | 2 +- extra/project-euler/common/common.factor | 2 +- misc/vim/syntax/factor.vim | 2 +- unmaintained/graph-theory/graph-theory.factor | 2 +- 32 files changed, 40 insertions(+), 41 deletions(-) diff --git a/basis/compiler/cfg/builder/builder-tests.factor b/basis/compiler/cfg/builder/builder-tests.factor index a4651b87b5..9d1502d3f0 100644 --- a/basis/compiler/cfg/builder/builder-tests.factor +++ b/basis/compiler/cfg/builder/builder-tests.factor @@ -162,7 +162,7 @@ IN: compiler.cfg.builder.tests : count-insns ( quot insn-check -- ? ) [ test-mr [ instructions>> ] map ] dip - '[ _ count ] sigma ; inline + '[ _ count ] map-sum ; inline : contains-insn? ( quot insn-check -- ? ) count-insns 0 > ; inline diff --git a/basis/compiler/cfg/gc-checks/gc-checks.factor b/basis/compiler/cfg/gc-checks/gc-checks.factor index 5d3c79e40f..7285685b48 100644 --- a/basis/compiler/cfg/gc-checks/gc-checks.factor +++ b/basis/compiler/cfg/gc-checks/gc-checks.factor @@ -26,7 +26,7 @@ M: ##box-alien allocation-size* drop 4 cells ; M: ##box-displaced-alien allocation-size* drop 4 cells ; : allocation-size ( bb -- n ) - instructions>> [ ##allocation? ] filter [ allocation-size* ] sigma ; + instructions>> [ ##allocation? ] filter [ allocation-size* ] map-sum ; : insert-gc-check ( bb -- ) dup dup '[ @@ -44,4 +44,4 @@ M: ##box-displaced-alien allocation-size* drop 4 cells ; dup blocks-with-gc [ over compute-uninitialized-sets [ insert-gc-check ] each - ] unless-empty ; \ No newline at end of file + ] unless-empty ; diff --git a/basis/fry/fry.factor b/basis/fry/fry.factor index d68e2d13a8..184c6247a6 100644 --- a/basis/fry/fry.factor +++ b/basis/fry/fry.factor @@ -32,7 +32,7 @@ PREDICATE: fry-specifier < word { _ @ } member-eq? ; GENERIC: count-inputs ( quot -- n ) -M: callable count-inputs [ count-inputs ] sigma ; +M: callable count-inputs [ count-inputs ] map-sum ; M: fry-specifier count-inputs drop 1 ; M: object count-inputs drop 0 ; diff --git a/basis/math/primes/erato/erato-tests.factor b/basis/math/primes/erato/erato-tests.factor index e78e5210f9..e6f7765bd6 100644 --- a/basis/math/primes/erato/erato-tests.factor +++ b/basis/math/primes/erato/erato-tests.factor @@ -7,4 +7,4 @@ USING: byte-arrays math math.bitwise math.primes.erato sequences tools.test ; [ t ] [ 113 100 sieve marked-prime? ] unit-test ! There are 25997 primes below 300000. 1 must be removed and 3 5 7 added. -[ 25997 ] [ 299999 sieve [ bit-count ] sigma 2 + ] unit-test \ No newline at end of file +[ 25997 ] [ 299999 sieve [ bit-count ] map-sum 2 + ] unit-test diff --git a/basis/math/statistics/statistics.factor b/basis/math/statistics/statistics.factor index a1a214b2c0..85909bc097 100644 --- a/basis/math/statistics/statistics.factor +++ b/basis/math/statistics/statistics.factor @@ -12,7 +12,7 @@ IN: math.statistics [ length ] [ product ] bi nth-root ; : harmonic-mean ( seq -- x ) - [ recip ] sigma recip ; + [ recip ] map-sum recip ; :: kth-smallest ( seq k -- elt ) #! Wirth's method, Algorithm's + Data structues = Programs p. 84 @@ -75,7 +75,7 @@ IN: math.statistics dup length 1 <= [ drop 0 ] [ - [ [ mean ] keep [ - sq ] with sigma ] + [ [ mean ] keep [ - sq ] with map-sum ] [ length 1 - ] bi / ] if ; diff --git a/basis/pack/pack.factor b/basis/pack/pack.factor index 3b9739fb0f..a330337c5e 100755 --- a/basis/pack/pack.factor +++ b/basis/pack/pack.factor @@ -97,7 +97,7 @@ MACRO: pack ( str -- quot ) packed-length-table at ; inline : packed-length ( str -- n ) - [ ch>packed-length ] sigma ; + [ ch>packed-length ] map-sum ; : pack-native ( seq str -- seq ) '[ _ _ pack ] with-native-endian ; inline diff --git a/basis/roman/roman.factor b/basis/roman/roman.factor index bc86db31c6..f8c7da9ab4 100644 --- a/basis/roman/roman.factor +++ b/basis/roman/roman.factor @@ -43,7 +43,7 @@ PRIVATE> : >ROMAN ( n -- str ) >roman >upper ; : roman> ( str -- n ) - >lower [ roman>= ] monotonic-split [ (roman>) ] sigma ; + >lower [ roman>= ] monotonic-split [ (roman>) ] map-sum ; > ] map-counters ; : cumulative-counters ( obj quot -- alist ) - '[ dup @ [ counter>> ] sigma ] map-counters ; inline + '[ dup @ [ counter>> ] map-sum ] map-counters ; inline : vocab-counters ( -- alist ) vocabs [ words [ predicate? not ] filter ] cumulative-counters ; diff --git a/basis/ui/gadgets/paragraphs/paragraphs.factor b/basis/ui/gadgets/paragraphs/paragraphs.factor index fd5ae0b246..12de4bacd9 100644 --- a/basis/ui/gadgets/paragraphs/paragraphs.factor +++ b/basis/ui/gadgets/paragraphs/paragraphs.factor @@ -40,7 +40,7 @@ TUPLE: line words height ; dup wrap-words [ ] map ; : line-width ( wrapped-line -- n ) - [ break?>> ] trim-tail-slice [ width>> ] sigma ; + [ break?>> ] trim-tail-slice [ width>> ] map-sum ; : max-line-width ( wrapped-paragraph -- x ) [ words>> line-width ] [ max ] map-reduce ; @@ -82,4 +82,4 @@ M: paragraph baseline M: paragraph cap-height pack-cap-height ; -PRIVATE> \ No newline at end of file +PRIVATE> diff --git a/core/classes/tuple/tuple.factor b/core/classes/tuple/tuple.factor index ccb4e30c31..3e449e624e 100755 --- a/core/classes/tuple/tuple.factor +++ b/core/classes/tuple/tuple.factor @@ -118,7 +118,7 @@ ERROR: bad-superclass class ; } case define-predicate ; : class-size ( class -- n ) - superclasses [ "slots" word-prop length ] sigma ; + superclasses [ "slots" word-prop length ] map-sum ; : (instance-check-quot) ( class -- quot ) [ diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor index 8851628b21..224702185e 100755 --- a/core/sequences/sequences-docs.factor +++ b/core/sequences/sequences-docs.factor @@ -975,13 +975,12 @@ HELP: produce-as { $description "Calls " { $snippet "pred" } " repeatedly. If the predicate yields " { $link f } ", stops, otherwise, calls " { $snippet "quot" } " to yield a value. Values are accumulated and returned in a sequence of type " { $snippet "exemplar" } " at the end." } { $examples "See " { $link produce } " for examples." } ; -HELP: sigma +HELP: map-sum { $values { "seq" sequence } { "quot" quotation } { "n" number } } { $description "Like map sum, but without creating an intermediate sequence." } { $example - "! Find the sum of the squares [0,99]" "USING: math math.ranges sequences prettyprint ;" - "100 [1,b] [ sq ] sigma ." + "100 [1,b] [ sq ] map-sum ." "338350" } ; diff --git a/core/sequences/sequences-tests.factor b/core/sequences/sequences-tests.factor index dc99542da8..c82caec3f9 100644 --- a/core/sequences/sequences-tests.factor +++ b/core/sequences/sequences-tests.factor @@ -243,7 +243,7 @@ unit-test [ "asdf " ] [ " asdf " [ CHAR: \s = ] trim-head ] unit-test [ " asdf" ] [ " asdf " [ CHAR: \s = ] trim-tail ] unit-test -[ 328350 ] [ 100 [ sq ] sigma ] unit-test +[ 328350 ] [ 100 [ sq ] map-sum ] unit-test [ 50 ] [ 100 [ even? ] count ] unit-test [ 50 ] [ 100 [ odd? ] count ] unit-test diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor index 81e5401c4b..9298a719e0 100755 --- a/core/sequences/sequences.factor +++ b/core/sequences/sequences.factor @@ -934,10 +934,10 @@ PRIVATE> : supremum ( seq -- n ) [ ] [ max ] map-reduce ; -: sigma ( seq quot -- n ) +: map-sum ( seq quot -- n ) [ 0 ] 2dip [ dip + ] curry [ swap ] prepose each ; inline -: count ( seq quot -- n ) [ 1 0 ? ] compose sigma ; inline +: count ( seq quot -- n ) [ 1 0 ? ] compose map-sum ; inline ! We hand-optimize flip to such a degree because type hints ! cannot express that an array is an array of arrays yet, and diff --git a/extra/benchmark/backtrack/backtrack.factor b/extra/benchmark/backtrack/backtrack.factor index 27040edac3..856fd8e25d 100755 --- a/extra/benchmark/backtrack/backtrack.factor +++ b/extra/benchmark/backtrack/backtrack.factor @@ -38,9 +38,9 @@ MEMO: 24-from-4 ( a b c d -- ? ) 1 10 [a,b] [| d | a b c d 24-from-4 ] count - ] sigma - ] sigma - ] sigma ; + ] map-sum + ] map-sum + ] map-sum ; CONSTANT: words { 24-from-1 24-from-2 24-from-3 24-from-4 } diff --git a/extra/benchmark/e-ratios/e-ratios.factor b/extra/benchmark/e-ratios/e-ratios.factor index 4957822b5e..a909602f8c 100644 --- a/extra/benchmark/e-ratios/e-ratios.factor +++ b/extra/benchmark/e-ratios/e-ratios.factor @@ -4,7 +4,7 @@ USING: kernel math math.combinatorics math.ranges sequences ; IN: benchmark.e-ratios : calculate-e-ratios ( n -- e ) - iota [ factorial recip ] sigma ; + iota [ factorial recip ] map-sum ; : calculate-e-ratios-benchmark ( -- ) 5 [ 300 calculate-e-ratios drop ] times ; diff --git a/extra/benchmark/tuple-arrays/tuple-arrays.factor b/extra/benchmark/tuple-arrays/tuple-arrays.factor index bd9a7139b3..38ce0087a2 100644 --- a/extra/benchmark/tuple-arrays/tuple-arrays.factor +++ b/extra/benchmark/tuple-arrays/tuple-arrays.factor @@ -14,7 +14,7 @@ TUPLE-ARRAY: point [ 1 + ] change-x [ 1 - ] change-y [ 1 + 2 / ] change-z - ] map [ z>> ] sigma - ] sigma . ; + ] map [ z>> ] map-sum + ] map-sum . ; MAIN: tuple-array-benchmark diff --git a/extra/project-euler/021/021.factor b/extra/project-euler/021/021.factor index 0401aad9be..165d463a46 100644 --- a/extra/project-euler/021/021.factor +++ b/extra/project-euler/021/021.factor @@ -30,7 +30,7 @@ IN: project-euler.021 { [ = not ] [ sum-proper-divisors = ] } 2&& ; : euler021 ( -- answer ) - 10000 [1,b] [ dup amicable? [ drop 0 ] unless ] sigma ; + 10000 [1,b] [ dup amicable? [ drop 0 ] unless ] map-sum ; ! [ euler021 ] 100 ave-time ! 335 ms ave run time - 18.63 SD (100 trials) diff --git a/extra/project-euler/028/028.factor b/extra/project-euler/028/028.factor index 6dc284f802..b134d369de 100644 --- a/extra/project-euler/028/028.factor +++ b/extra/project-euler/028/028.factor @@ -33,7 +33,7 @@ IN: project-euler.028 dup 1 = [ [ sq 4 * ] [ 6 * ] bi - 6 + ] unless ; : sum-diags ( n -- sum ) - 1 swap 2 [ sum-corners ] sigma ; + 1 swap 2 [ sum-corners ] map-sum ; PRIVATE> diff --git a/extra/project-euler/030/030.factor b/extra/project-euler/030/030.factor index b689df50bb..25d78d9465 100644 --- a/extra/project-euler/030/030.factor +++ b/extra/project-euler/030/030.factor @@ -33,7 +33,7 @@ IN: project-euler.030 digits [ 5 ^ ] sigma ; + number>digits [ 5 ^ ] map-sum ; PRIVATE> diff --git a/extra/project-euler/034/034.factor b/extra/project-euler/034/034.factor index f7a4865da7..959c66fea4 100644 --- a/extra/project-euler/034/034.factor +++ b/extra/project-euler/034/034.factor @@ -34,7 +34,7 @@ IN: project-euler.034 { 1 1 2 6 24 120 720 5040 40320 362880 } nth ; : factorion? ( n -- ? ) - dup number>digits [ digit-factorial ] sigma = ; + dup number>digits [ digit-factorial ] map-sum = ; PRIVATE> diff --git a/extra/project-euler/043/043.factor b/extra/project-euler/043/043.factor index bea7313abd..cf49557506 100644 --- a/extra/project-euler/043/043.factor +++ b/extra/project-euler/043/043.factor @@ -92,7 +92,7 @@ PRIVATE> PRIVATE> : euler043a ( -- answer ) - interesting-pandigitals [ 10 digits>integer ] sigma ; + interesting-pandigitals [ 10 digits>integer ] map-sum ; ! [ euler043a ] 100 ave-time ! 10 ms ave run time - 1.37 SD (100 trials) diff --git a/extra/project-euler/048/048.factor b/extra/project-euler/048/048.factor index fde3fa6026..d0e267f73c 100644 --- a/extra/project-euler/048/048.factor +++ b/extra/project-euler/048/048.factor @@ -18,7 +18,7 @@ IN: project-euler.048 ! -------- : euler048 ( -- answer ) - 1000 [1,b] [ dup ^ ] sigma 10 10^ mod ; + 1000 [1,b] [ dup ^ ] map-sum 10 10^ mod ; ! [ euler048 ] 100 ave-time ! 276 ms run / 1 ms GC ave time - 100 trials diff --git a/extra/project-euler/053/053.factor b/extra/project-euler/053/053.factor index 111b8147fb..faca6a8ad5 100644 --- a/extra/project-euler/053/053.factor +++ b/extra/project-euler/053/053.factor @@ -27,7 +27,7 @@ IN: project-euler.053 ! -------- : euler053 ( -- answer ) - 23 100 [a,b] [ dup [ nCk 1000000 > ] with count ] sigma ; + 23 100 [a,b] [ dup [ nCk 1000000 > ] with count ] map-sum ; ! [ euler053 ] 100 ave-time ! 52 ms ave run time - 4.44 SD (100 trials) diff --git a/extra/project-euler/063/063.factor b/extra/project-euler/063/063.factor index 80e3990a24..59552db882 100644 --- a/extra/project-euler/063/063.factor +++ b/extra/project-euler/063/063.factor @@ -29,7 +29,7 @@ IN: project-euler.063 ! Round down since we already know that particular value of n is no good. : euler063 ( -- answer ) - 9 [1,b] [ log [ 10 log dup ] dip - /i ] sigma ; + 9 [1,b] [ log [ 10 log dup ] dip - /i ] map-sum ; ! [ euler063 ] 100 ave-time ! 0 ms ave run time - 0.0 SD (100 trials) diff --git a/extra/project-euler/072/072.factor b/extra/project-euler/072/072.factor index 9fab6788bd..cdd11bb55c 100644 --- a/extra/project-euler/072/072.factor +++ b/extra/project-euler/072/072.factor @@ -30,7 +30,7 @@ IN: project-euler.072 ! The answer can be found by adding totient(n) for 2 ≤ n ≤ 1e6 : euler072 ( -- answer ) - 2 1000000 [a,b] [ totient ] sigma ; + 2 1000000 [a,b] [ totient ] map-sum ; ! [ euler072 ] 100 ave-time ! 5274 ms ave run time - 102.7 SD (100 trials) diff --git a/extra/project-euler/074/074.factor b/extra/project-euler/074/074.factor index 7f0a54a43c..1fff789cf7 100644 --- a/extra/project-euler/074/074.factor +++ b/extra/project-euler/074/074.factor @@ -48,7 +48,7 @@ IN: project-euler.074 { 1 1 2 6 24 120 720 5040 40320 362880 } nth ; : digits-factorial-sum ( n -- n ) - number>digits [ digit-factorial ] sigma ; + number>digits [ digit-factorial ] map-sum ; : chain-length ( n -- n ) 61 diff --git a/extra/project-euler/092/092.factor b/extra/project-euler/092/092.factor index 9f22460b3c..973572572d 100644 --- a/extra/project-euler/092/092.factor +++ b/extra/project-euler/092/092.factor @@ -29,7 +29,7 @@ IN: project-euler.092 digits [ sq ] sigma ; + number>digits [ sq ] map-sum ; : chain-ending ( n -- m ) dup [ 1 = ] [ 89 = ] bi or [ next-link chain-ending ] unless ; diff --git a/extra/project-euler/116/116.factor b/extra/project-euler/116/116.factor index 43eb30c9f6..50252582fa 100644 --- a/extra/project-euler/116/116.factor +++ b/extra/project-euler/116/116.factor @@ -47,7 +47,7 @@ IN: project-euler.116 V{ 1 } clone [ [ next ] 2curry times ] keep last 1 - ; : (euler116) ( length -- permutations ) - 3 [1,b] [ ways ] with sigma ; + 3 [1,b] [ ways ] with map-sum ; PRIVATE> diff --git a/extra/project-euler/190/190.factor b/extra/project-euler/190/190.factor index 19ff2c253c..460580c7c0 100644 --- a/extra/project-euler/190/190.factor +++ b/extra/project-euler/190/190.factor @@ -46,7 +46,7 @@ PRIVATE> m [1,b] [| i | 2 i * m 1 + / i ^ ] PI ; : euler190 ( -- answer ) - 2 15 [a,b] [ P_m truncate ] sigma ; + 2 15 [a,b] [ P_m truncate ] map-sum ; ! [ euler150 ] 100 ave-time ! 5 ms ave run time - 1.01 SD (100 trials) diff --git a/extra/project-euler/common/common.factor b/extra/project-euler/common/common.factor index 3d320fad62..9eb9e968ca 100644 --- a/extra/project-euler/common/common.factor +++ b/extra/project-euler/common/common.factor @@ -57,7 +57,7 @@ IN: project-euler.common PRIVATE> : alpha-value ( str -- n ) - >lower [ CHAR: a - 1 + ] sigma ; + >lower [ CHAR: a - 1 + ] map-sum ; : cartesian-product ( seq1 seq2 -- seq1xseq2 ) [ [ 2array ] with map ] curry map concat ; diff --git a/misc/vim/syntax/factor.vim b/misc/vim/syntax/factor.vim index 13b999250d..340cdff032 100644 --- a/misc/vim/syntax/factor.vim +++ b/misc/vim/syntax/factor.vim @@ -53,7 +53,7 @@ syn keyword factorKeyword or tuck 2bi 2tri while wrapper nip 4dip wrapper? bi* c syn keyword factorKeyword ?at assoc? assoc-clone-like assoc= delete-at* assoc-partition extract-keys new-assoc value? assoc-size map>assoc push-at assoc-like key? assoc-intersect assoc-refine update assoc-union assoc-combine at* assoc-empty? at+ set-at assoc-all? assoc-subset? assoc-hashcode change-at assoc-each assoc-diff zip values value-at rename-at inc-at enum? at cache assoc>map assoc assoc-map enum value-at* assoc-map-as >alist assoc-filter-as clear-assoc assoc-stack maybe-set-at substitute assoc-filter 2cache delete-at assoc-find keys assoc-any? unzip syn keyword factorKeyword case execute-effect no-cond no-case? 3cleave>quot 2cleave cond>quot wrong-values? no-cond? cleave>quot no-case case>quot 3cleave wrong-values to-fixed-point alist>quot case-find cond cleave call-effect 2cleave>quot recursive-hashcode linear-case-quot spread spread>quot syn keyword factorKeyword byte-array>bignum sgn >bignum next-float number= each-integer next-power-of-2 ?1+ fp-special? imaginary-part mod recip float>bits rational >float number? 2^ bignum? integer fixnum? neg fixnum sq bignum fp-snan? fp-infinity? denominator (all-integers?) times find-last-integer (each-integer) bit? * + fp-bitwise= - fp-qnan? / power-of-2? >= bitand find-integer complex < log2 > integer? real number bits>double double>bits bitor 2/ zero? rem fp-nan-payload all-integers? (find-integer) real-part prev-float align bits>float float? shift float fp-nan? abs bitxor ratio? even? <= /mod odd? >integer ratio rational? bitnot real? >fixnum complex? /i numerator /f -syn keyword factorKeyword append assert-sequence= find-last-from trim-head-slice clone-like 3sequence assert-sequence? map-as filter! last-index-from reversed index-from cut* pad-tail (indices) concat-as remove-eq but-last snip trim-tail nths nth 2pusher sequence slice? partition remove-nth tail-slice empty? tail* if-empty find-from virtual-sequence? member? set-length remove-eq! drop-prefix unclip iota unclip-last-slice bounds-error? sequence-hashcode-step map start midpoint@ rest-slice prepend fourth sift delete sigma new-sequence follow like remove-nth! first4 1sequence reverse slice unless-empty padding virtual@ repetition? set-last index 4sequence max-length set-second immutable-sequence first2 first3 replicate-as reduce-index unclip-slice supremum insert-nth trim-tail-slice tail 3append short count suffix concat flip filter sum immutable? 2sequence map-integers delete-all start* indices snip-slice check-slice sequence? head map-find reduce append-as reverse! sequence= halves collapse-slice interleave 2map binary-reduce virtual-seq slice-error? product bounds-check? bounds-check harvest immutable find produce remove pad-head last replicate set-fourth shorten reversed? map-find-last 3map-as 2unclip-slice shorter? 3map find-last head-slice pop* 2map-as tail-slice* but-last-slice 2map-reduce iota? accumulate each pusher cut-slice new-resizable each-index head-slice* 2reverse-each sequence-hashcode member-eq? pop set-nth ?nth second map! join when-empty accumulator immutable-sequence? all? 3append-as virtual-sequence subseq? push-either new-like length last-index push-if 2all? lengthen assert-sequence copy map-reduce move third first 3each tail? set-first prefix bounds-error any? trim-slice exchange surround 2reduce cut change-nth min-length set-third produce-as push-all head? delete-slice rest sum-lengths 2each head* infimum glue slice-error subseq replace-slice push repetition map-index trim-head unclip-last mismatch trim +syn keyword factorKeyword append assert-sequence= find-last-from trim-head-slice clone-like 3sequence assert-sequence? map-as filter! last-index-from reversed index-from cut* pad-tail (indices) concat-as remove-eq but-last snip trim-tail nths nth 2pusher sequence slice? partition remove-nth tail-slice empty? tail* if-empty find-from virtual-sequence? member? set-length remove-eq! drop-prefix unclip iota unclip-last-slice bounds-error? sequence-hashcode-step map start midpoint@ rest-slice prepend fourth sift remove! map-sum new-sequence follow like remove-nth! first4 1sequence reverse slice unless-empty padding virtual@ repetition? set-last index 4sequence max-length set-second immutable-sequence first2 first3 replicate-as reduce-index unclip-slice supremum insert-nth trim-tail-slice tail 3append short count suffix concat flip filter sum immutable? 2sequence map-integers delete-all start* indices snip-slice check-slice sequence? head map-find reduce append-as reverse! sequence= halves collapse-slice interleave 2map binary-reduce virtual-seq slice-error? product bounds-check? bounds-check harvest immutable find produce remove pad-head last replicate set-fourth shorten reversed? map-find-last 3map-as 2unclip-slice shorter? 3map find-last head-slice pop* 2map-as tail-slice* but-last-slice 2map-reduce iota? accumulate each pusher cut-slice new-resizable each-index head-slice* 2reverse-each sequence-hashcode member-eq? pop set-nth ?nth second map! join when-empty accumulator immutable-sequence? all? 3append-as virtual-sequence subseq? push-either new-like length last-index push-if 2all? lengthen assert-sequence copy map-reduce move third first 3each tail? set-first prefix bounds-error any? trim-slice exchange surround 2reduce cut change-nth min-length set-third produce-as push-all head? delete-slice rest sum-lengths 2each head* infimum glue slice-error subseq replace-slice push repetition map-index trim-head unclip-last mismatch trim syn keyword factorKeyword global +@ change set-namestack change-global init-namespaces on off set-global namespace set with-scope bind with-variable inc dec counter initialize namestack get get-global make-assoc syn keyword factorKeyword 2array 3array pair >array 1array 4array pair? array resize-array array? syn keyword factorKeyword +character+ bad-seek-type? readln stream-seek read print with-output-stream contents write1 stream-write1 stream-copy stream-element-type with-input-stream stream-print stream-read stream-contents bl seek-output bad-seek-type nl stream-nl write flush stream-lines +byte+ stream-flush read1 seek-absolute? stream-read1 lines stream-readln stream-read-until each-line seek-end with-output-stream* seek-absolute with-streams seek-input seek-relative? input-stream stream-write read-partial seek-end? seek-relative error-stream read-until with-input-stream* with-streams* each-block output-stream stream-read-partial diff --git a/unmaintained/graph-theory/graph-theory.factor b/unmaintained/graph-theory/graph-theory.factor index 1b4224c864..e14ffb4a83 100644 --- a/unmaintained/graph-theory/graph-theory.factor +++ b/unmaintained/graph-theory/graph-theory.factor @@ -34,7 +34,7 @@ M: graph num-vertices vertices length ; M: graph num-edges - [ vertices ] [ '[ _ adjlist length ] sigma ] bi ; + [ vertices ] [ '[ _ adjlist length ] map-sum ] bi ; M: graph adjlist [ vertices ] [ swapd '[ _ swap _ adj? ] filter ] bi ;