]> gitweb.factorcode.org Git - factor.git/commitdiff
filter-here -> filter!
authorSlava Pestov <slava@factorcode.org>
Wed, 28 Oct 2009 05:44:05 +0000 (00:44 -0500)
committerSlava Pestov <slava@factorcode.org>
Wed, 28 Oct 2009 05:44:05 +0000 (00:44 -0500)
16 files changed:
basis/compiler/cfg/copy-prop/copy-prop.factor
basis/compiler/cfg/dce/dce.factor
basis/compiler/cfg/linear-scan/allocation/allocation.factor
basis/compiler/cfg/linear-scan/allocation/spilling/spilling.factor
basis/compiler/cfg/linear-scan/allocation/state/state.factor
basis/compiler/cfg/ssa/destruction/destruction.factor
basis/compiler/cfg/write-barrier/write-barrier.factor
basis/compiler/tree/cleanup/cleanup.factor
core/assocs/assocs-docs.factor
core/assocs/assocs.factor
core/hashtables/hashtables-tests.factor
core/sequences/sequences-docs.factor
core/sequences/sequences-tests.factor
core/sequences/sequences.factor
core/source-files/errors/errors.factor
misc/vim/syntax/factor.vim

index 6919ba8b9b06eb7d1b9fa4d81fa24f7690bfe42d..23382c3dbecd22c762bac9395cc73280b1d2d574 100644 (file)
@@ -63,7 +63,7 @@ M: insn update-insn rename-insn-uses t ;
     copies get dup assoc-empty? [ 2drop ] [
         renamings set
         [
-            instructions>> [ update-insn ] filter-here
+            instructions>> [ update-insn ] filter! drop
         ] each-basic-block
     ] if ;
 
index b8735e224c3e6f8dd92485173a3418a4215aeb35..03a43d0ab7860f641d633e583719946a530bc055 100644 (file)
@@ -117,5 +117,5 @@ M: insn live-insn? defs-vreg [ live-vreg? ] [ t ] if* ;
     dup
     [ [ instructions>> [ build-liveness-graph ] each ] each-basic-block ]
     [ [ instructions>> [ compute-live-vregs ] each ] each-basic-block ]
-    [ [ instructions>> [ live-insn? ] filter-here ] each-basic-block ]
+    [ [ instructions>> [ live-insn? ] filter! drop ] each-basic-block ]
     tri ;
index ac32265e654723e0f339a36324f4320ea754d1fb..8951d7a1f1e15b9e34bfc2535485755d1a13f8a2 100644 (file)
@@ -42,7 +42,7 @@ IN: compiler.cfg.linear-scan.allocation
 
 : handle-sync-point ( n -- )
     [ active-intervals get values ] dip
-    '[ [ _ spill-at-sync-point ] filter-here ] each ;
+    '[ [ _ spill-at-sync-point ] filter! drop ] each ;
 
 :: handle-progress ( n sync? -- )
     n {
index ec4fe02cfa3813f9bef6717acf7b576ca55d6e82..845cb14d5c8738f5fb3985e5fa25979f8be3dd47 100644 (file)
@@ -18,13 +18,13 @@ ERROR: bad-live-ranges interval ;
 
 : trim-before-ranges ( live-interval -- )
     [ ranges>> ] [ uses>> last 1 + ] bi
-    [ '[ from>> _ <= ] filter-here ]
+    [ '[ from>> _ <= ] filter! drop ]
     [ swap last (>>to) ]
     2bi ;
 
 : trim-after-ranges ( live-interval -- )
     [ ranges>> ] [ uses>> first ] bi
-    [ '[ to>> _ >= ] filter-here ]
+    [ '[ to>> _ >= ] filter! drop ]
     [ swap first (>>from) ]
     2bi ;
 
@@ -114,7 +114,7 @@ ERROR: bad-live-ranges interval ;
                 new start>> spill f
             ] [ drop t ] if
         ] [ drop t ] if
-    ] filter-here ;
+    ] filter! drop ;
 
 : spill-intersecting ( new reg -- )
     ! Split and spill all active and inactive intervals
index ea0879032da8d2ed45f8ceb621468b34efa16b17..4c825c9d7ce62c9c6eab8be06c3e9186a67096f3 100644 (file)
@@ -83,7 +83,7 @@ ERROR: register-already-used live-interval ;
 ! Moving intervals between active and inactive sets
 : process-intervals ( n symbol quots -- )
     ! symbol stores an alist mapping register classes to vectors
-    [ get values ] dip '[ [ _ cond ] with filter-here ] with each ; inline
+    [ get values ] dip '[ [ _ cond ] with filter! drop ] with each ; inline
 
 : deactivate-intervals ( n -- )
     ! Any active intervals which have ended are moved to handled
index 071b5d4b2040bcfad4f6129cff00ddda9878d308..d93045da550acb9dbc496a7e7fc81ccddd391ed7 100644 (file)
@@ -102,7 +102,7 @@ M: ##phi prepare-insn
             [ rename-insn-defs ]
             [ rename-insn-uses ]
             [ [ useless-copy? ] [ ##phi? ] bi or not ] tri
-        ] filter-here
+        ] filter! drop
     ] each-basic-block ;
 
 : destruct-ssa ( cfg -- cfg' )
@@ -114,4 +114,4 @@ M: ##phi prepare-insn
     dup compute-live-ranges
     dup prepare-coalescing
     process-copies
-    dup perform-renaming ;
\ No newline at end of file
+    dup perform-renaming ;
index 0217055923d025ef2d4821cd5c3b802ba6193c60..523f7c6d1ced65c45e05869eb5f166e049af2fd2 100644 (file)
@@ -37,7 +37,7 @@ M: insn eliminate-write-barrier drop t ;
 : write-barriers-step ( bb -- )
     H{ } clone fresh-allocations set
     H{ } clone mutated-objects set
-    instructions>> [ eliminate-write-barrier ] filter-here ;
+    instructions>> [ eliminate-write-barrier ] filter! drop ;
 
 : eliminate-write-barriers ( cfg -- cfg' )
     dup [ write-barriers-step ] each-basic-block ;
index 1cd9589065334bd27e5701829a9d545a7a1ffbee..8ed83188e5ddd6841f019340e4081501e78513be 100644 (file)
@@ -20,7 +20,7 @@ IN: compiler.tree.cleanup
 GENERIC: delete-node ( node -- )
 
 M: #call-recursive delete-node
-    dup label>> calls>> [ node>> eq? not ] with filter-here ;
+    dup label>> calls>> [ node>> eq? not ] with filter! drop ;
 
 M: #return-recursive delete-node
     label>> f >>return drop ;
index c1b9e2cb565c7ce43e82b1bb563036e8403a542f..5a69df8cb4367d4f3b5d4a1e0af293e6d28fd91e 100755 (executable)
@@ -97,7 +97,6 @@ ARTICLE: "assocs-sets" "Set-theoretic operations on assocs"
     assoc-union
     assoc-diff
     substitute
-    substitute-here
     extract-keys
 }
 { $see-also key? assoc-any? assoc-all? "sets" } ;
@@ -348,12 +347,6 @@ HELP: assoc-diff
 { $description "Outputs an assoc consisting of all entries from " { $snippet "assoc1" } " whose key is not contained in " { $snippet "assoc2" } "." } 
 ;
 
-HELP: substitute-here
-{ $values { "seq" "a mutable sequence" } { "assoc" assoc } }
-{ $description "Replaces elements of " { $snippet "seq" } " which appear as keys in " { $snippet "assoc" } " with the corresponding values, acting as the identity on all other elements." }
-{ $errors "Throws an error if " { $snippet "assoc" } " contains values whose types are not permissible in " { $snippet "seq" } "." }
-{ $side-effects "seq" } ;
-
 HELP: substitute
 { $values { "seq" sequence } { "assoc" assoc } { "newseq" sequence } }
 { $description "Creates a new sequence where elements of " { $snippet "seq" } " which appear as keys in " { $snippet "assoc" } " are replaced by the corresponding values, and all other elements are unchanged." } ;
index 9e4a6e221eb696f73589a051a4a95c9c17ac0430..6b66a79358ef5bcfb17226b73429d3bf7b3efb21 100755 (executable)
@@ -135,9 +135,6 @@ M: assoc assoc-clone-like ( assoc exemplar -- newassoc )
 : assoc-diff ( assoc1 assoc2 -- diff )
     [ nip key? not ] curry assoc-filter ;
 
-: substitute-here ( seq assoc -- )
-    substituter map! drop ;
-
 : substitute ( seq assoc -- newseq )
     substituter map ;
 
index 54e58c0282729653e990cf8052d7fab3c3bcd66f..05cc27f5e8bfc0e48e61ba4336de65717e7cd81f 100644 (file)
@@ -155,11 +155,6 @@ H{ } "x" set
     ] { } make
 ] unit-test
 
-[ { "one" "two" 3 } ] [
-    { 1 2 3 } clone dup
-    H{ { 1 "one" } { 2 "two" } } substitute-here
-] unit-test
-
 [ { "one" "two" 3 } ] [
     { 1 2 3 } H{ { 1 "one" } { 2 "two" } } substitute
 ] unit-test
index 775734f0f701c217288dfa11e59f9b4c865872d4..6740b51d4d717e3093241fca9e80595c4350541c 100755 (executable)
@@ -430,8 +430,8 @@ HELP: filter-as
 { $values { "seq" sequence } { "quot" { $quotation "( elt -- ? )" } } { "exemplar" sequence } { "subseq" "a new sequence" } }
 { $description "Applies the quotation to each element in turn, and outputs a new sequence of the same type as " { $snippet "exemplar" } " containing the elements of the original sequence for which the quotation output a true value." } ;
 
-HELP: filter-here
-{ $values { "seq" "a resizable mutable sequence" } { "quot" { $quotation "( elt -- ? )" } } }
+HELP: filter!
+{ $values { "seq" "a resizable mutable sequence" } { "quot" { $quotation "( elt -- ? )" } } { "seq" "a resizable mutable sequence" } }
 { $description "Applies the quotation to each element in turn, and removes elements for which the quotation outputs a false value." }
 { $side-effects "seq" } ;
 
@@ -1065,7 +1065,7 @@ HELP: harvest
     }
 } ;
 
-{ filter filter-here sift harvest } related-words
+{ filter filter! sift harvest } related-words
 
 HELP: set-first
 { $values
@@ -1598,7 +1598,7 @@ ARTICLE: "sequences-destructive" "Destructive operations"
     remove-nth!
     delete-slice
     delete-all
-    filter-here
+    filter!
 }
 "Other destructive words:"
 { $subsections
@@ -1620,7 +1620,7 @@ ARTICLE: "sequences-destructive" "Destructive operations"
     { { $link reverse } { $link reverse-here } }
     { { $link append } { $link push-all } }
     { { $link map } { $link map! } }
-    { { $link filter } { $link filter-here } }
+    { { $link filter } { $link filter! } }
 }
 { $heading "Related Articles" }
 { $subsections
index 0acc1b7344017d4cc5efeaa43421b6526d4cce7d..d25c62c561d2aac9fc7c339b38c0cfd960e8c825 100644 (file)
@@ -59,10 +59,10 @@ IN: sequences.tests
 
 [ [ 3 ] ] [ [ 1 2 3 ] 2 [ swap < ] curry filter ] unit-test
 
-[ V{ 1 2 3 } ] [ V{ 1 4 2 5 3 6 } clone [ [ 4 < ] filter-here ] keep ] unit-test
-[ V{ 4 2 6 } ] [ V{ 1 4 2 5 3 6 } clone [ [ 2 mod 0 = ] filter-here ] keep ] unit-test
+[ V{ 1 2 3 } ] [ V{ 1 4 2 5 3 6 } clone [ 4 < ] filter! ] unit-test
+[ V{ 4 2 6 } ] [ V{ 1 4 2 5 3 6 } clone [ 2 mod 0 = ] filter! ] unit-test
 
-[ V{ 3 } ] [ V{ 1 2 3 } clone [ 2 [ swap < ] curry filter-here ] keep ] unit-test
+[ V{ 3 } ] [ V{ 1 2 3 } clone 2 [ swap < ] curry filter! ] unit-test
 
 [ "hello world how are you" ]
 [ { "hello" "world" "how" "are" "you" } " " join ]
index 940bfe0137f9966e8ad0c46859c00bdab85c9332..c74a7c3ad0a3d3010895f318d16ebc7c9ced224d 100755 (executable)
@@ -619,24 +619,24 @@ M: slice equal? over slice? [ sequence= ] [ 2drop f ] if ;
 
 <PRIVATE
 
-: (filter-here) ( quot: ( elt -- ? ) store scan seq -- )
+: (filter!) ( quot: ( elt -- ? ) store scan seq -- )
     2dup length < [
         [ move ] 3keep
         [ nth-unsafe pick call [ 1 + ] when ] 2keep
         [ 1 + ] dip
-        (filter-here)
+        (filter!)
     ] [ nip set-length drop ] if ; inline recursive
 
 PRIVATE>
 
-: filter-here ( seq quot -- )
-    swap [ 0 0 ] dip (filter-here) ; inline
+: filter! ( seq quot -- seq )
+    swap [ [ 0 0 ] dip (filter!) ] keep ; inline
 
 : remove! ( elt seq -- seq )
-    [ [ = not ] with filter-here ] keep ;
+    [ = not ] with filter! ;
 
 : remove-eq! ( elt seq -- seq )
-    [ [ eq? not ] with filter-here ] keep ;
+    [ eq? not ] with filter! ;
 
 : prefix ( seq elt -- newseq )
     over [ over length 1 + ] dip [
index b240b6929e5e32812e66706bc68e417cfade3d65..ebacc90f633c7b906bc9447847b9520630e94134 100644 (file)
@@ -80,7 +80,7 @@ SYMBOL: error-observers
     [
         [ swap file>> = ] [ swap error-type = ]
         bi-curry* bi and not
-    ] 2curry filter-here
+    ] 2curry filter! drop
     notify-error-observers ;
 
 : delete-definition-errors ( definition -- )
index e13834f9041bcabda44fe6b8afac201a0392bbdc..ef5046d6d6340a9b88d2dfb4b58ec38a594aeec8 100644 (file)
@@ -50,10 +50,10 @@ syn keyword factorCompileDirective inline foldable recursive
 
 syn keyword factorKeyword boolean
 syn keyword factorKeyword or tuck 2bi 2tri while wrapper nip 4dip wrapper? bi* callstack>array both? hashcode die dupd callstack callstack? 3dup tri@ pick curry build ?execute 3bi prepose >boolean ?if clone eq? tri* ? = swapd call-clear 2over 2keep 3keep clear 2dup when not tuple? dup 2bi* 2tri* call tri-curry object bi@ do unless* if* loop bi-curry* drop when* assert= retainstack assert? -rot execute 2bi@ 2tri@ boa with either? 3drop bi curry? datastack until 3dip over 3curry roll tri-curry* swap tri-curry@ 2nip and throw set-retainstack bi-curry (clone) hashcode* compose spin 2dip if 3tri unless compose? tuple keep 2curry equal? set-datastack assert tri 2drop most <wrapper> boolean? identity-tuple? null new set-callstack dip bi-curry@ rot -roll xor identity-tuple boolean
-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 <enum> assoc assoc-map enum value-at* assoc-map-as >alist assoc-filter-as substitute-here clear-assoc assoc-stack maybe-set-at substitute assoc-filter 2cache delete-at assoc-find keys assoc-any? unzip
+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 <enum> 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 <fp-nan> < 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-here last-index-from reversed index-from cut* pad-tail (indices) concat-as remove-eq but-last snip trim-tail nths nth 2pusher sequence slice? <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-here 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 memq? pop set-nth ?nth <flat-slice> second map! join when-empty accumulator immutable-sequence? <reversed> 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? <repetition> 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? <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-here 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 memq? pop set-nth ?nth <flat-slice> second map! join when-empty accumulator immutable-sequence? <reversed> 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? <repetition> 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 <array> 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