From 01aab7c88461d0e8ef178181d294bd2dbbc57891 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 3 Jul 2017 12:00:44 -0700 Subject: [PATCH] Factor: Rename to to not confuse with ENUM:s --- basis/base64/base64-tests.factor | 2 +- basis/compiler/codegen/gc-maps/gc-maps.factor | 2 +- basis/compression/huffman/huffman.factor | 2 +- basis/compression/inflate/inflate.factor | 2 +- basis/inspector/inspector.factor | 2 +- basis/math/combinatorics/combinatorics.factor | 2 +- basis/mirrors/mirrors.factor | 2 +- basis/xml/syntax/inverse/inverse.factor | 2 +- basis/xml/syntax/syntax.factor | 2 +- core/assocs/assocs-docs.factor | 12 ++++---- core/assocs/assocs.factor | 28 +++++++++---------- core/classes/tuple/parser/parser.factor | 2 +- core/generic/single/single.factor | 4 +-- extra/backtrack/backtrack.factor | 2 +- extra/html/parser/analyzer/analyzer.factor | 2 +- extra/math/transforms/bwt/bwt.factor | 2 +- extra/memcached/memcached.factor | 4 +-- extra/multi-methods/multi-methods.factor | 2 +- extra/sequences/extras/extras.factor | 6 ++-- misc/atom/grammars/factor.cson | 2 +- misc/vim/syntax/factor.vim | 2 +- 21 files changed, 43 insertions(+), 43 deletions(-) diff --git a/basis/base64/base64-tests.factor b/basis/base64/base64-tests.factor index d708c1b3d3..a63f6b3bc6 100644 --- a/basis/base64/base64-tests.factor +++ b/basis/base64/base64-tests.factor @@ -38,4 +38,4 @@ sequences splitting strings tools.test ; } [ "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJKb2UifQ.ipevRNuRP6HflG8cFKnmUPtypruRC4fb1DWtoLL62SY" "." split [ base64> ] map -] unit-test \ No newline at end of file +] unit-test diff --git a/basis/compiler/codegen/gc-maps/gc-maps.factor b/basis/compiler/codegen/gc-maps/gc-maps.factor index 47e47382c7..61e9076a66 100644 --- a/basis/compiler/codegen/gc-maps/gc-maps.factor +++ b/basis/compiler/codegen/gc-maps/gc-maps.factor @@ -40,7 +40,7 @@ SYMBOLS: return-addresses gc-maps ; [ emit-gc-roots ] ?{ } make underlying>> % ; : emit-base-table ( alist longest -- ) - -1 swap assoc-union! seq>> emit-uints ; + -1 swap assoc-union! seq>> emit-uints ; : derived-root-offsets ( gc-map -- offsets ) derived-roots>> [ [ gc-root-offset ] bi@ ] assoc-map ; diff --git a/basis/compression/huffman/huffman.factor b/basis/compression/huffman/huffman.factor index 33d7b17f05..9956f3c55f 100644 --- a/basis/compression/huffman/huffman.factor +++ b/basis/compression/huffman/huffman.factor @@ -43,7 +43,7 @@ TUPLE: huffman-code [ nip '[ _ swap _ set-at ] each ] 3bi ; :: reverse-table ( tdesc n -- rtable ) - n f :> table + n f :> table tdesc [ n table update-reverse-table ] huffman-each table seq>> ; diff --git a/basis/compression/inflate/inflate.factor b/basis/compression/inflate/inflate.factor index 400f02e0e2..7b74370036 100644 --- a/basis/compression/inflate/inflate.factor +++ b/basis/compression/inflate/inflate.factor @@ -26,7 +26,7 @@ ERROR: bad-zlib-header ; CONSTANT: clen-shuffle { 16 17 18 0 8 7 9 6 10 5 11 4 12 3 13 2 14 1 15 } : get-table ( values size -- table ) - 16 f + 16 f [ '[ _ push-at ] 2each ] keep seq>> rest-slice [ natural-sort ] map ; inline diff --git a/basis/inspector/inspector.factor b/basis/inspector/inspector.factor index 70733b1aea..f0ecd0b8aa 100644 --- a/basis/inspector/inspector.factor +++ b/basis/inspector/inspector.factor @@ -20,7 +20,7 @@ SYMBOL: +number-rows+ GENERIC: add-numbers ( alist -- table' ) -M: enum add-numbers ; +M: enumerated add-numbers ; M: assoc add-numbers +number-rows+ get [ [ prefix ] map-index ] when ; diff --git a/basis/math/combinatorics/combinatorics.factor b/basis/math/combinatorics/combinatorics.factor index 5f8eb8514f..6c6792ed89 100644 --- a/basis/math/combinatorics/combinatorics.factor +++ b/basis/math/combinatorics/combinatorics.factor @@ -129,7 +129,7 @@ PRIVATE> swapd each-permutation ; inline : inverse-permutation ( seq -- permutation ) - sort-values keys ; + sort-values keys ; ; +M: sequence make-mirror ; M: object make-mirror ; diff --git a/basis/xml/syntax/inverse/inverse.factor b/basis/xml/syntax/inverse/inverse.factor index dba6469b7d..983060b811 100644 --- a/basis/xml/syntax/inverse/inverse.factor +++ b/basis/xml/syntax/inverse/inverse.factor @@ -66,7 +66,7 @@ M: interpolated [undo-xml] : >enum ( assoc -- enum ) ! Assumes keys are 0..n - sort-keys values ; + sort-keys values ; : undo-xml ( xml -- quot ) [undo-xml] '[ H{ } clone [ _ with-variables ] keep >enum ] ; diff --git a/basis/xml/syntax/syntax.factor b/basis/xml/syntax/syntax.factor index 8bea35c615..c2f5496790 100644 --- a/basis/xml/syntax/syntax.factor +++ b/basis/xml/syntax/syntax.factor @@ -152,7 +152,7 @@ MACRO: interpolate-xml ( xml -- quot ) [ [ var>> , ] each-interpolated ] { } make ; : nenum ( ... n -- assoc ) - narray ; inline + narray ; inline : collect ( accum variables -- accum ? ) { diff --git a/core/assocs/assocs-docs.factor b/core/assocs/assocs-docs.factor index 36b1730ba8..384f0a79b7 100644 --- a/core/assocs/assocs-docs.factor +++ b/core/assocs/assocs-docs.factor @@ -19,19 +19,19 @@ $nl ARTICLE: "enums" "Enumerations" "An enumeration provides a view of a sequence as an assoc mapping integer indices to elements:" { $subsections - enum - + enumerated + } "Inverting a permutation using enumerations:" -{ $example "IN: scratchpad" ": invert ( perm -- perm' )" " sort-values keys ;" "{ 2 0 4 1 3 } invert ." "{ 1 3 0 4 2 }" } ; +{ $example "IN: scratchpad" ": invert ( perm -- perm' )" " sort-values keys ;" "{ 2 0 4 1 3 } invert ." "{ 1 3 0 4 2 }" } ; -HELP: enum +HELP: enumerated { $class-description "An associative structure which wraps a sequence and maps integers to the corresponding elements of the sequence." $nl "Enumerations are mutable; note that deleting a key calls " { $link remove-nth! } ", which results in all subsequent elements being shifted down." } ; -HELP: -{ $values { "seq" sequence } { "enum" enum } } +HELP: +{ $values { "seq" sequence } { "enumerated" enumerated } } { $description "Creates a new enumeration." } ; ARTICLE: "assocs-protocol" "Associative mapping protocol" diff --git a/core/assocs/assocs.factor b/core/assocs/assocs.factor index 3f4b3b890c..40fb12ac81 100644 --- a/core/assocs/assocs.factor +++ b/core/assocs/assocs.factor @@ -281,32 +281,32 @@ M: f assoc-like drop dup assoc-empty? [ drop f ] when ; inline INSTANCE: sequence assoc -TUPLE: enum { seq read-only } ; +TUPLE: enumerated { seq read-only } ; -C: enum +C: enumerated -M: enum at* +M: enumerated at* seq>> 2dup bounds-check? [ nth-unsafe t ] [ 2drop f f ] if ; inline -M: enum set-at seq>> set-nth ; inline +M: enumerated set-at seq>> set-nth ; inline -M: enum delete-at seq>> remove-nth! drop ; inline +M: enumerated delete-at seq>> remove-nth! drop ; inline -M: enum >alist ( enum -- alist ) ; inline +M: enumerated >alist ( enumerated -- alist ) ; inline -M: enum keys seq>> length >array ; inline +M: enumerated keys seq>> length >array ; inline -M: enum values seq>> >array ; inline +M: enumerated values seq>> >array ; inline -M: enum assoc-size seq>> length ; inline +M: enumerated assoc-size seq>> length ; inline -M: enum clear-assoc seq>> delete-all ; inline +M: enumerated clear-assoc seq>> delete-all ; inline -INSTANCE: enum assoc +INSTANCE: enumerated assoc -M: enum length seq>> length ; inline +M: enumerated length seq>> length ; inline -M: enum nth-unsafe dupd seq>> nth-unsafe 2array ; inline +M: enumerated nth-unsafe dupd seq>> nth-unsafe 2array ; inline -INSTANCE: enum immutable-sequence +INSTANCE: enumerated immutable-sequence diff --git a/core/classes/tuple/parser/parser.factor b/core/classes/tuple/parser/parser.factor index 08b57a747b..1ca47ee2ef 100644 --- a/core/classes/tuple/parser/parser.factor +++ b/core/classes/tuple/parser/parser.factor @@ -103,7 +103,7 @@ M: tuple-class boa>object over [ slot-named* ] dip check-slot-exists drop ; : assoc>object ( class slots values -- tuple ) - [ [ [ initial>> ] map ] keep ] dip + [ [ [ initial>> ] map ] keep ] dip swap [ [ slot-named-checked ] curry dip ] curry assoc-map assoc-union! seq>> boa>object ; diff --git a/core/generic/single/single.factor b/core/generic/single/single.factor index afa6376983..bef4a22765 100644 --- a/core/generic/single/single.factor +++ b/core/generic/single/single.factor @@ -157,7 +157,7 @@ GENERIC: compile-engine ( engine -- obj ) [ over assumed [ compile-engine ] with-variable ] assoc-map ; : direct-dispatch-table ( assoc n -- table ) - default get swap assoc-union! seq>> ; + default get swap assoc-union! seq>> ; : tag-number ( class -- n ) "type" word-prop ; @@ -184,7 +184,7 @@ M: tuple-dispatch-engine compile-engine tuple assumed [ echelons>> compile-engines dup keys supremum 1 + f - swap assoc-union! seq>> + swap assoc-union! seq>> ] with-variable ; PREDICATE: predicate-engine-word < word "owner-generic" word-prop ; diff --git a/extra/backtrack/backtrack.factor b/extra/backtrack/backtrack.factor index a87a031e00..c7b2da90bd 100644 --- a/extra/backtrack/backtrack.factor +++ b/extra/backtrack/backtrack.factor @@ -60,7 +60,7 @@ PRIVATE> [ fail f ] [ unsafe-amb ] if-empty ; inline MACRO: amb-execute ( seq -- quot ) - [ length 1 - ] [ [ 1quotation ] assoc-map ] bi + [ length 1 - ] [ [ 1quotation ] assoc-map ] bi '[ _ 0 unsafe-number-from-to nip _ case ] ; : if-amb ( true false -- ? ) diff --git a/extra/html/parser/analyzer/analyzer.factor b/extra/html/parser/analyzer/analyzer.factor index b564b9009b..cf275bcba1 100644 --- a/extra/html/parser/analyzer/analyzer.factor +++ b/extra/html/parser/analyzer/analyzer.factor @@ -18,7 +18,7 @@ IN: html.parser.analyzer swap attributes>> key? ; : find-all ( seq quot -- alist ) - [ >alist ] [ '[ second @ ] ] bi* filter ; inline + [ >alist ] [ '[ second @ ] ] bi* filter ; inline : loopn-index ( n quot -- ) [ ] [ '[ @ not ] ] bi* find 2drop ; inline diff --git a/extra/math/transforms/bwt/bwt.factor b/extra/math/transforms/bwt/bwt.factor index 9431f6a8c4..1aca5dddad 100644 --- a/extra/math/transforms/bwt/bwt.factor +++ b/extra/math/transforms/bwt/bwt.factor @@ -13,5 +13,5 @@ IN: math.transforms.bwt : ibwt ( i newseq -- seq ) [ length ] - [ sort-values '[ _ nth first2 ] ] + [ sort-values '[ _ nth first2 ] ] [ replicate-as ] tri nip ; diff --git a/extra/memcached/memcached.factor b/extra/memcached/memcached.factor index 8ff2a03de3..df3e04e884 100644 --- a/extra/memcached/memcached.factor +++ b/extra/memcached/memcached.factor @@ -184,10 +184,10 @@ PRIVATE> : m/getseq ( keys -- vals ) [ H{ } clone ] dip - [ [ m/getq ] assoc-each ] + [ [ m/getq ] assoc-each ] [ length 10 + NOOP swap >>opaque send-request ] [ - [ + [ assoc-size 10 + '[ _ read-header [ check-opaque ] keep swap ] diff --git a/extra/multi-methods/multi-methods.factor b/extra/multi-methods/multi-methods.factor index 74b3e0cd6e..f5637789ea 100644 --- a/extra/multi-methods/multi-methods.factor +++ b/extra/multi-methods/multi-methods.factor @@ -41,7 +41,7 @@ SYMBOL: total ] assoc-map ; : canonicalize-specializer-3 ( specializer -- specializer' ) - [ total get object ] dip assoc-union! seq>> ; + [ total get object ] dip assoc-union! seq>> ; : canonicalize-specializers ( methods -- methods' hooks ) [ diff --git a/extra/sequences/extras/extras.factor b/extra/sequences/extras/extras.factor index c26f4869ee..d8e23af43e 100644 --- a/extra/sequences/extras/extras.factor +++ b/extra/sequences/extras/extras.factor @@ -5,7 +5,7 @@ vectors ; IN: sequences.extras : find-all ( ... seq quot: ( ... elt -- ... ? ) -- ... elts ) - [ ] dip '[ nip @ ] assoc-filter ; inline + [ ] dip '[ nip @ ] assoc-filter ; inline : reduce-from ( ... seq identity quot: ( ... prev elt -- ... next ) i -- ... result ) [ swap ] 2dip each-from ; inline @@ -403,10 +403,10 @@ INSTANCE: odds immutable-sequence [ dup empty? ] swap until drop ; inline : arg-max ( seq -- n ) - [ second-unsafe ] supremum-by first ; + [ second-unsafe ] supremum-by first ; : arg-min ( seq -- n ) - [ second-unsafe ] infimum-by first ; + [ second-unsafe ] infimum-by first ; alist||2cache|\\?at|\\?of|assoc|assoc>map|assoc-all\\?|assoc-any\\?|assoc-clone-like|assoc-combine|assoc-diff|assoc-diff!|assoc-differ|assoc-each|assoc-empty\\?|assoc-filter|assoc-filter!|assoc-filter-as|assoc-find|assoc-hashcode|assoc-intersect|assoc-like|assoc-map|assoc-map-as|assoc-partition|assoc-refine|assoc-size|assoc-stack|assoc-subset\\?|assoc-union|assoc-union!|assoc=|assoc\\?|at|at\\*|at\\+|cache|change-at|clear-assoc|delete-at|delete-at\\*|enum|enum\\?|extract-keys|inc-at|key\\?|keys|map>assoc|maybe-set-at|new-assoc|of|push-at|rename-at|set-at|sift-keys|sift-values|substitute|unzip|value-at|value-at\\*|value\\?|values|zip|zip-as|zip-index|zip-index-as)(\\s|$)" + match: "(^|(?<=\\s))(>alist||2cache|\\?at|\\?of|assoc|assoc>map|assoc-all\\?|assoc-any\\?|assoc-clone-like|assoc-combine|assoc-diff|assoc-diff!|assoc-differ|assoc-each|assoc-empty\\?|assoc-filter|assoc-filter!|assoc-filter-as|assoc-find|assoc-hashcode|assoc-intersect|assoc-like|assoc-map|assoc-map-as|assoc-partition|assoc-refine|assoc-size|assoc-stack|assoc-subset\\?|assoc-union|assoc-union!|assoc=|assoc\\?|at|at\\*|at\\+|cache|change-at|clear-assoc|delete-at|delete-at\\*|enum|enum\\?|extract-keys|inc-at|key\\?|keys|map>assoc|maybe-set-at|new-assoc|of|push-at|rename-at|set-at|sift-keys|sift-values|substitute|unzip|value-at|value-at\\*|value\\?|values|zip|zip-as|zip-index|zip-index-as)(\\s|$)" name: "keyword.control.assocs.factor" } { diff --git a/misc/vim/syntax/factor.vim b/misc/vim/syntax/factor.vim index a112da608e..5aaf1268a4 100644 --- a/misc/vim/syntax/factor.vim +++ b/misc/vim/syntax/factor.vim @@ -54,7 +54,7 @@ syn match factorExecute /\/ contai syn keyword factorCallNextMethod call-next-method syn keyword factorKeyword (clone) -rot 2bi 2bi* 2bi@ 2curry 2dip 2drop 2dup 2keep 2nip 2over 2tri 2tri* 2tri@ 2with 3bi 3curry 3dip 3drop 3dup 3keep 3tri 4dip 4drop 4dup 4keep = >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? curry curried? 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 loop most new nip not null object or over pick prepose rot same? swap swapd throw tri tri* tri-curry tri-curry* tri-curry@ tri@ tuple tuple? unless unless* until when when* while with wrapper wrapper? xor -syn keyword factorKeyword 2cache >alist ?at ?of assoc assoc-all? assoc-any? assoc-clone-like assoc-combine assoc-diff assoc-diff! assoc-differ assoc-each assoc-empty? assoc-filter assoc-filter! assoc-filter-as assoc-find assoc-hashcode assoc-intersect assoc-like assoc-map assoc-map-as assoc-partition assoc-refine assoc-reject assoc-reject! assoc-reject-as assoc-size assoc-stack assoc-subset? assoc-union assoc-union! assoc= assoc>map assoc? at at* at+ cache change-at clear-assoc delete-at delete-at* enum enum? extract-keys harvest-keys harvest-values inc-at key? keys map>alist map>assoc maybe-set-at new-assoc of push-at rename-at set-at sift-keys sift-values substitute unzip value-at value-at* value? values zip zip-as zip-index zip-index-as +syn keyword factorKeyword 2cache >alist ?at ?of assoc assoc-all? assoc-any? assoc-clone-like assoc-combine assoc-diff assoc-diff! assoc-differ assoc-each assoc-empty? assoc-filter assoc-filter! assoc-filter-as assoc-find assoc-hashcode assoc-intersect assoc-like assoc-map assoc-map-as assoc-partition assoc-refine assoc-reject assoc-reject! assoc-reject-as assoc-size assoc-stack assoc-subset? assoc-union assoc-union! assoc= assoc>map assoc? at at* at+ cache change-at clear-assoc delete-at delete-at* enum enum? extract-keys harvest-keys harvest-values inc-at key? keys map>alist map>assoc maybe-set-at new-assoc of push-at rename-at set-at sift-keys sift-values substitute unzip value-at value-at* value? values zip zip-as zip-index zip-index-as syn keyword factorKeyword 2cleave 2cleave>quot 3cleave 3cleave>quot 4cleave 4cleave>quot alist>quot call-effect case case-find case>quot cleave cleave>quot cond cond>quot deep-spread>quot execute-effect linear-case-quot no-case no-case? no-cond no-cond? recursive-hashcode shallow-spread>quot spread to-fixed-point wrong-values wrong-values? syn keyword factorKeyword (all-integers?) (each-integer) (find-integer) * + - / /f /i /mod 2/ 2^ < <= > >= >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? fast-gcd 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 sq times u< u<= u> u>= unless-zero unordered? when-zero zero? syn keyword factorKeyword 1sequence 2all? 2each 2each-from 2map 2map-as 2map-reduce 2reduce 2selector 2sequence 3append 3append-as 3each 3map 3map-as 3sequence 4sequence ?first ?last ?nth ?second ?set-nth accumulate accumulate! accumulate-as all? any? append append! append-as assert-sequence assert-sequence= assert-sequence? binary-reduce bounds-check bounds-check? bounds-error bounds-error? but-last but-last-slice cartesian-each cartesian-map cartesian-product change-nth check-slice clone-like collapse-slice collector collector-for concat concat-as copy count cut cut* cut-slice delete-all delete-slice drop-prefix each each-from each-index empty? exchange filter filter! filter-as find find-from find-index find-index-from find-last find-last-from first first2 first3 first4 flip follow fourth glue halves harvest head head* head-slice head-slice* head? if-empty immutable immutable-sequence immutable-sequence? immutable? index index-from indices infimum infimum-by insert-nth interleave iota iota-tuple iota-tuple? join join-as last last-index last-index-from length lengthen like longer longer? longest map map! map-as map-find map-find-last map-index map-index-as map-integers map-reduce map-sum max-length member-eq? member? midpoint@ min-length mismatch move new-like new-resizable new-sequence non-negative-integer-expected non-negative-integer-expected? nth nths pad-head pad-tail padding partition pop pop* prefix prepend prepend-as produce produce-as product push push-all push-either push-if reduce reduce-index reject reject! reject-as remove remove! remove-eq remove-eq! remove-nth remove-nth! repetition repetition? replace-slice replicate replicate-as rest rest-slice reverse reverse! reversed reversed? second selector selector-for sequence sequence-hashcode sequence= sequence? set-first set-fourth set-last set-length set-nth set-second set-third short shorten shorter shorter? shortest sift slice slice-error slice-error? slice? snip snip-slice subseq-start subseq-start-from subseq subseq? suffix suffix! sum sum-lengths supremum supremum-by surround tail tail* tail-slice tail-slice* tail? third trim trim-head trim-head-slice trim-slice trim-tail trim-tail-slice unclip unclip-last unclip-last-slice unclip-slice unless-empty virtual-exemplar virtual-sequence virtual-sequence? virtual@ when-empty