diff --git a/core/assocs/assocs-docs.factor b/core/assocs/assocs-docs.factor index e85789a4f2..687e60621e 100755 --- a/core/assocs/assocs-docs.factor +++ b/core/assocs/assocs-docs.factor @@ -69,10 +69,10 @@ ARTICLE: "assocs-lookup" "Lookup and querying of assocs" ARTICLE: "assocs-sets" "Set-theoretic operations on assocs" "It is often useful to use the keys of an associative mapping as a set, exploiting the constant or logarithmic lookup time of most implementations (" { $link "alists" } " being a notable exception)." { $subsection subassoc? } -{ $subsection intersect } +{ $subsection assoc-intersect } { $subsection update } -{ $subsection union } -{ $subsection diff } +{ $subsection assoc-union } +{ $subsection assoc-diff } { $subsection remove-all } { $subsection substitute } { $subsection substitute-here } @@ -260,7 +260,7 @@ HELP: values { keys values } related-words -HELP: intersect +HELP: assoc-intersect { $values { "assoc1" assoc } { "assoc2" assoc } { "intersection" "a new assoc" } } { $description "Outputs an assoc consisting of all entries from " { $snippet "assoc2" } " such that the key is also present in " { $snippet "assoc1" } "." } { $notes "The values of the keys in " { $snippet "assoc1" } " are disregarded, so this word is usually used for set-theoretic calculations where the assoc in question either has dummy sentinels as values, or the values equal the keys." } ; @@ -270,11 +270,11 @@ HELP: update { $description "Adds all entries from " { $snippet "assoc2" } " to " { $snippet "assoc1" } "." } { $side-effects "assoc1" } ; -HELP: union +HELP: assoc-union { $values { "assoc1" assoc } { "assoc2" assoc } { "union" "a new assoc" } } { $description "Outputs a assoc consisting of all entries from " { $snippet "assoc1" } " and " { $snippet "assoc2" } ", with entries from " { $snippet "assoc2" } " taking precedence in case the corresponding values are not equal." } ; -HELP: diff +HELP: assoc-diff { $values { "assoc1" assoc } { "assoc2" assoc } { "diff" "a new assoc" } } { $description "Outputs an assoc consisting of all entries from " { $snippet "assoc2" } " whose key is not contained in " { $snippet "assoc1" } "." } ; diff --git a/core/assocs/assocs-tests.factor b/core/assocs/assocs-tests.factor index c4db604784..76f484006d 100755 --- a/core/assocs/assocs-tests.factor +++ b/core/assocs/assocs-tests.factor @@ -58,24 +58,24 @@ H{ } clone "cache-test" set ] [ H{ { "factor" "rocks" } { "dup" "sq" } { 3 4 } } H{ { "factor" "rocks" } { 1 2 } { 2 3 } { 3 4 } } - intersect + assoc-intersect ] unit-test [ H{ { 1 2 } { 2 3 } { 6 5 } } ] [ H{ { 2 4 } { 6 5 } } H{ { 1 2 } { 2 3 } } - union + assoc-union ] unit-test [ H{ { 1 2 } { 2 3 } } t ] [ - f H{ { 1 2 } { 2 3 } } [ union ] 2keep swap union dupd = + f H{ { 1 2 } { 2 3 } } [ assoc-union ] 2keep swap assoc-union dupd = ] unit-test [ H{ { 1 f } } ] [ - H{ { 1 f } } H{ { 1 f } } intersect + H{ { 1 f } } H{ { 1 f } } assoc-intersect ] unit-test [ { 1 3 } ] [ H{ { 2 2 } } { 1 2 3 } remove-all ] unit-test diff --git a/core/assocs/assocs.factor b/core/assocs/assocs.factor index adb69d317c..4a6ecae4fe 100755 --- a/core/assocs/assocs.factor +++ b/core/assocs/assocs.factor @@ -109,17 +109,17 @@ M: assoc assoc-clone-like ( assoc exemplar -- newassoc ) >r over r> hashcode* 2/ >r dupd hashcode* r> bitxor ] { } assoc>map hashcode* ; -: intersect ( assoc1 assoc2 -- intersection ) +: assoc-intersect ( assoc1 assoc2 -- intersection ) swap [ nip key? ] curry assoc-subset ; : update ( assoc1 assoc2 -- ) swap [ swapd set-at ] curry assoc-each ; -: union ( assoc1 assoc2 -- union ) +: assoc-union ( assoc1 assoc2 -- union ) 2dup [ assoc-size ] bi@ + pick new-assoc [ rot update ] keep [ swap update ] keep ; -: diff ( assoc1 assoc2 -- diff ) +: assoc-diff ( assoc1 assoc2 -- diff ) swap [ nip key? not ] curry assoc-subset ; : remove-all ( assoc seq -- subseq ) diff --git a/core/bootstrap/layouts/layouts.factor b/core/bootstrap/layouts/layouts.factor index ceb011d52b..e839576bc9 100755 --- a/core/bootstrap/layouts/layouts.factor +++ b/core/bootstrap/layouts/layouts.factor @@ -36,4 +36,4 @@ tag-numbers get H{ { word 17 } { byte-array 18 } { tuple-layout 19 } -} union type-numbers set +} assoc-union type-numbers set diff --git a/core/classes/classes.factor b/core/classes/classes.factor index b22e21eb92..4f43b86f64 100755 --- a/core/classes/classes.factor +++ b/core/classes/classes.factor @@ -89,7 +89,7 @@ M: word reset-class drop ; dup reset-class dup deferred? [ dup define-symbol ] when dup word-props - r> union over set-word-props + r> assoc-union over set-word-props dup predicate-word [ 1quotation "predicate" set-word-prop ] [ swap "predicating" set-word-prop ] diff --git a/core/generator/generator.factor b/core/generator/generator.factor index 7858205384..919e89d3c8 100755 --- a/core/generator/generator.factor +++ b/core/generator/generator.factor @@ -202,7 +202,7 @@ M: #dispatch generate-node : define-if>boolean-intrinsics ( word intrinsics -- ) [ >r [ if>boolean-intrinsic ] curry r> - { { f "if-scratch" } } +scratch+ associate union + { { f "if-scratch" } } +scratch+ associate assoc-union ] assoc-map "intrinsics" set-word-prop ; : define-if-intrinsics ( word intrinsics -- ) diff --git a/core/io/streams/nested/nested.factor b/core/io/streams/nested/nested.factor index 6b8953f86e..fd67910b6f 100755 --- a/core/io/streams/nested/nested.factor +++ b/core/io/streams/nested/nested.factor @@ -45,7 +45,7 @@ C: ignore-close-stream TUPLE: style-stream < filter-writer style ; : do-nested-style ( style style-stream -- style stream ) - [ style>> swap union ] [ stream>> ] bi ; inline + [ style>> swap assoc-union ] [ stream>> ] bi ; inline C: style-stream diff --git a/core/optimizer/backend/backend.factor b/core/optimizer/backend/backend.factor index e6b7533756..3237f095bf 100755 --- a/core/optimizer/backend/backend.factor +++ b/core/optimizer/backend/backend.factor @@ -17,7 +17,7 @@ SYMBOL: optimizer-changed GENERIC: optimize-node* ( node -- node/t changed? ) : ?union ( assoc/f assoc -- hash ) - over [ union ] [ nip ] if ; + over [ assoc-union ] [ nip ] if ; : add-node-literals ( assoc node -- ) over assoc-empty? [ @@ -82,7 +82,7 @@ M: node optimize-node* drop t f ; 2dup at* [ swap follow nip ] [ 2drop ] if ; : union* ( assoc1 assoc2 -- assoc ) - union [ keys ] keep + assoc-union [ keys ] keep [ dupd follow ] curry H{ } map>assoc ; diff --git a/core/parser/parser.factor b/core/parser/parser.factor index 4b4fae7a0c..65abd6c83c 100755 --- a/core/parser/parser.factor +++ b/core/parser/parser.factor @@ -501,14 +501,14 @@ SYMBOL: interactive-vocabs ] if ; : filter-moved ( assoc1 assoc2 -- seq ) - diff [ + assoc-diff [ drop where dup [ first ] when file get source-file-path = ] assoc-subset keys ; : removed-definitions ( -- assoc1 assoc2 ) new-definitions old-definitions - [ get first2 union ] bi@ ; + [ get first2 assoc-union ] bi@ ; : removed-classes ( -- assoc1 assoc2 ) new-definitions old-definitions diff --git a/core/sbufs/sbufs-tests.factor b/core/sbufs/sbufs-tests.factor index b30812b06f..ac3f565e56 100644 --- a/core/sbufs/sbufs-tests.factor +++ b/core/sbufs/sbufs-tests.factor @@ -19,6 +19,6 @@ IN: sbufs.tests [ SBUF" x" ] [ 1 CHAR: x >bignum over push ] unit-test -[ fixnum ] [ 1 >bignum SBUF" " new length class ] unit-test +[ fixnum ] [ 1 >bignum SBUF" " new-sequence length class ] unit-test [ fixnum ] [ 1 >bignum [ ] SBUF" " map-as length class ] unit-test diff --git a/core/sequences/sequences-tests.factor b/core/sequences/sequences-tests.factor index 281b27d540..8d0a91e384 100755 --- a/core/sequences/sequences-tests.factor +++ b/core/sequences/sequences-tests.factor @@ -240,7 +240,7 @@ unit-test [ ?{ f t } ] [ 0 2 ?{ f t f } subseq ] unit-test -[ V{ f f f } ] [ 3 V{ } new ] unit-test +[ V{ f f f } ] [ 3 V{ } new-sequence ] unit-test [ SBUF" \0\0\0" ] [ 3 SBUF" " new ] unit-test [ 0 ] [ f length ] unit-test diff --git a/core/source-files/source-files.factor b/core/source-files/source-files.factor index b385fbf369..5703b631f4 100755 --- a/core/source-files/source-files.factor +++ b/core/source-files/source-files.factor @@ -69,7 +69,7 @@ M: pathname forget* pathname-string forget-source ; : rollback-source-file ( file -- ) - dup source-file-definitions new-definitions get [ union ] 2map + dup source-file-definitions new-definitions get [ assoc-union ] 2map swap set-source-file-definitions ; SYMBOL: file diff --git a/core/vectors/vectors-tests.factor b/core/vectors/vectors-tests.factor index 18aa0f3fa7..8f64265771 100755 --- a/core/vectors/vectors-tests.factor +++ b/core/vectors/vectors-tests.factor @@ -94,6 +94,6 @@ IN: vectors.tests 100 >array dup >vector >array >r reverse r> = ] unit-test -[ fixnum ] [ 1 >bignum V{ } new length class ] unit-test +[ fixnum ] [ 1 >bignum V{ } new-sequence length class ] unit-test [ fixnum ] [ 1 >bignum [ ] V{ } map-as length class ] unit-test diff --git a/extra/cocoa/messages/messages.factor b/extra/cocoa/messages/messages.factor index 5ae02ec66a..ca9509c3ec 100755 --- a/extra/cocoa/messages/messages.factor +++ b/extra/cocoa/messages/messages.factor @@ -139,7 +139,7 @@ H{ { "NSRect" "{_NSRect=ffff}" } { "NSSize" "{_NSSize=ff}" } { "NSRange" "{_NSRange=II}" } -} union alien>objc-types set-global +} assoc-union alien>objc-types set-global : objc-struct-type ( i string -- ctype ) 2dup CHAR: = -rot index* swap subseq diff --git a/extra/delegate/protocols/protocols.factor b/extra/delegate/protocols/protocols.factor index 736645890e..f1ad068fe2 100755 --- a/extra/delegate/protocols/protocols.factor +++ b/extra/delegate/protocols/protocols.factor @@ -5,7 +5,7 @@ io definitions kernel continuations ; IN: delegate.protocols PROTOCOL: sequence-protocol - clone clone-like like new new-resizable nth nth-unsafe + clone clone-like like new-sequence new-resizable nth nth-unsafe set-nth set-nth-unsafe length set-length lengthen ; PROTOCOL: assoc-protocol diff --git a/extra/help/markup/markup.factor b/extra/help/markup/markup.factor index b963a19f29..2e2b34ebfd 100755 --- a/extra/help/markup/markup.factor +++ b/extra/help/markup/markup.factor @@ -79,7 +79,7 @@ M: f print-element drop ; [ strong-style get print-element* ] ($heading) ; : ($code-style) ( presentation -- hash ) - presented associate code-style get union ; + presented associate code-style get assoc-union ; : ($code) ( presentation quot -- ) [ diff --git a/extra/http/server/actions/actions.factor b/extra/http/server/actions/actions.factor index fabddcdeb1..2b2aaea6a8 100755 --- a/extra/http/server/actions/actions.factor +++ b/extra/http/server/actions/actions.factor @@ -40,7 +40,7 @@ TUPLE: action init display submit get-params post-params ; M: action call-responder ( path action -- response ) '[ , , - [ +append-path associate request-params union params set ] + [ +append-path associate request-params assoc-union params set ] [ action set ] bi* request get method>> { { "GET" [ handle-get ] } diff --git a/extra/http/server/sessions/sessions.factor b/extra/http/server/sessions/sessions.factor index 1288b4f7a4..d41b54e156 100755 --- a/extra/http/server/sessions/sessions.factor +++ b/extra/http/server/sessions/sessions.factor @@ -84,7 +84,7 @@ TUPLE: url-sessions ; [ drop ] [ get-session ] 2bi ; : add-session-id ( query -- query' ) - session-id get [ session-id-key associate union ] when* ; + session-id get [ session-id-key associate assoc-union ] when* ; : session-form-field ( -- ) > swap environment-mode>> { - { +prepend-environment+ [ os-envs union ] } - { +append-environment+ [ os-envs swap union ] } + { +prepend-environment+ [ os-envs assoc-union ] } + { +append-environment+ [ os-envs swap assoc-union ] } { +replace-environment+ [ ] } } case ; diff --git a/extra/tools/deploy/config/config.factor b/extra/tools/deploy/config/config.factor index 7ebedf7ca1..589d6c613b 100755 --- a/extra/tools/deploy/config/config.factor +++ b/extra/tools/deploy/config/config.factor @@ -65,7 +65,7 @@ SYMBOL: deploy-image { deploy-c-types? f } ! default value for deploy.macosx { "stop-after-last-window?" t } - } union ; + } assoc-union ; : deploy-config-path ( vocab -- string ) vocab-dir "deploy.factor" append-path ; @@ -73,7 +73,7 @@ SYMBOL: deploy-image : deploy-config ( vocab -- assoc ) dup default-config swap dup deploy-config-path vocab-file-contents - parse-fresh dup empty? [ drop ] [ first union ] if ; + parse-fresh dup empty? [ drop ] [ first assoc-union ] if ; : set-deploy-config ( assoc vocab -- ) >r unparse-use string-lines r> diff --git a/extra/tools/deploy/shaker/strip-cocoa.factor b/extra/tools/deploy/shaker/strip-cocoa.factor index de8f8740f0..038bfde70d 100755 --- a/extra/tools/deploy/shaker/strip-cocoa.factor +++ b/extra/tools/deploy/shaker/strip-cocoa.factor @@ -9,14 +9,14 @@ global [ [ "MiniFactor.nib" load-nib ] cocoa-init-hook set-global ! Only keeps those methods that we actually call - sent-messages get super-sent-messages get union - objc-methods [ intersect ] change + sent-messages get super-sent-messages get assoc-union + objc-methods [ assoc-intersect ] change sent-messages get super-sent-messages get [ keys [ objc-methods get at dup ] H{ } map>assoc ] bi@ - super-message-senders [ intersect ] change - message-senders [ intersect ] change + super-message-senders [ assoc-intersect ] change + message-senders [ assoc-intersect ] change sent-messages off super-sent-messages off diff --git a/extra/tuple-arrays/tuple-arrays.factor b/extra/tuple-arrays/tuple-arrays.factor index b9593af239..454a1c0b58 100644 --- a/extra/tuple-arrays/tuple-arrays.factor +++ b/extra/tuple-arrays/tuple-arrays.factor @@ -11,7 +11,7 @@ TUPLE: tuple-array example ; swap tuple>array length over length - ; : ( length example -- tuple-array ) - prepare-example [ rot * { } new ] keep + prepare-example [ rot * { } new-sequence ] keep tuple-array construct-delegate [ set-tuple-array-example ] keep ; diff --git a/extra/ui/commands/commands.factor b/extra/ui/commands/commands.factor index f73276bbe6..90eb6254cd 100755 --- a/extra/ui/commands/commands.factor +++ b/extra/ui/commands/commands.factor @@ -66,7 +66,7 @@ M: word command-description ( word -- str ) H{ { +nullary+ f } { +listener+ f } { +description+ f } } ; : define-command ( word hash -- ) - default-flags swap union >r word-props r> update ; + default-flags swap assoc-union >r word-props r> update ; : command-quot ( target command -- quot ) dup 1quotation swap +nullary+ word-prop diff --git a/extra/ui/operations/operations.factor b/extra/ui/operations/operations.factor index a9009e386e..26200ea96f 100755 --- a/extra/ui/operations/operations.factor +++ b/extra/ui/operations/operations.factor @@ -54,7 +54,7 @@ SYMBOL: operations H{ { +keyboard+ f } { +primary+ f } { +secondary+ f } } ; : define-operation ( pred command flags -- ) - default-flags swap union + default-flags swap assoc-union dupd define-command operations get push ; diff --git a/extra/unicode/data/data.factor b/extra/unicode/data/data.factor index b6449f6a0f..58d836464c 100755 --- a/extra/unicode/data/data.factor +++ b/extra/unicode/data/data.factor @@ -135,7 +135,7 @@ load-data dup process-names \ name-map set-value 13 over process-data \ simple-lower set-value 12 over process-data tuck \ simple-upper set-value -14 over process-data swapd union \ simple-title set-value +14 over process-data swapd assoc-union \ simple-title set-value dup process-combining \ class-map set-value dup process-canonical \ canonical-map set-value \ combine-map set-value diff --git a/extra/xml/data/data.factor b/extra/xml/data/data.factor index a7c8bf7b73..da2e4ccb32 100755 --- a/extra/xml/data/data.factor +++ b/extra/xml/data/data.factor @@ -62,7 +62,7 @@ M: attrs set-at ] if* ; M: attrs assoc-size attrs-alist length ; -M: attrs new-assoc drop V{ } new ; +M: attrs new-assoc drop V{ } new-sequence ; M: attrs >alist attrs-alist ; : >attrs ( assoc -- attrs )