]> gitweb.factorcode.org Git - factor.git/commitdiff
Finishing eliminating prune as a synonym of members
authorDaniel Ehrenberg <littledan@Macintosh-122.local>
Sat, 27 Feb 2010 19:52:24 +0000 (14:52 -0500)
committerDaniel Ehrenberg <littledan@Macintosh-122.local>
Sat, 27 Feb 2010 19:52:24 +0000 (14:52 -0500)
28 files changed:
basis/regexp/classes/classes.factor
basis/regexp/parser/parser.factor
basis/see/see.factor
basis/simple-flat-file/simple-flat-file.factor
basis/suffix-arrays/suffix-arrays.factor
basis/tools/deploy/shaker/shaker.factor
basis/tools/profiler/profiler.factor
basis/ui/gestures/gestures.factor
basis/ui/ui.factor
basis/unicode/data/data.factor
basis/vocabs/metadata/metadata.factor
basis/vocabs/refresh/monitor/monitor.factor
basis/vocabs/refresh/refresh.factor
basis/xmode/keyword-map/keyword-map.factor
core/classes/algebra/algebra.factor
core/sets/sets.factor
extra/contributors/contributors.factor
extra/fuel/xref/xref.factor
extra/html/parser/analyzer/analyzer.factor
extra/koszul/koszul.factor
extra/mason/test/test.factor
extra/project-euler/004/004.factor
extra/project-euler/029/029.factor
extra/project-euler/032/032.factor
extra/project-euler/059/059.factor
extra/project-euler/079/079.factor
extra/project-euler/203/203.factor
extra/spider/spider.factor

index e3e2f0bcf3fda5a0d63e7379fd5eec6de0cc2fdf..fd4c7e7e4fc16c4ea9fc55e7d39c2896acec62b5 100644 (file)
@@ -5,6 +5,7 @@ unicode.categories combinators.short-circuit sequences
 fry macros arrays assocs sets classes mirrors unicode.script
 unicode.data ;
 FROM: ascii => ascii? ;
+FROM: sets => members ;
 IN: regexp.classes
 
 SINGLETONS: dot letter-class LETTER-class Letter-class digit-class
@@ -157,7 +158,7 @@ DEFER: substitute
 TUPLE: class-partition integers not-integers simples not-simples and or other ;
 
 : partition-classes ( seq -- class-partition )
-    prune
+    members
     [ integer? ] partition
     [ not-integer? ] partition
     [ simple-class? ] partition
@@ -194,7 +195,7 @@ TUPLE: class-partition integers not-integers simples not-simples and or other ;
     [ t swap remove ] change-other
     dup contradiction?
     [ drop f ]
-    [ filter-not-integers class-partition>seq prune t and-class seq>instance ] if ;
+    [ filter-not-integers class-partition>seq members t and-class seq>instance ] if ;
 
 : <and-class> ( seq -- class )
     dup and-class flatten partition-classes
@@ -225,7 +226,7 @@ TUPLE: class-partition integers not-integers simples not-simples and or other ;
     [ f swap remove ] change-other
     dup tautology?
     [ drop t ]
-    [ filter-integers class-partition>seq prune f or-class seq>instance ] if ;
+    [ filter-integers class-partition>seq members f or-class seq>instance ] if ;
 
 : <or-class> ( seq -- class )
     dup or-class flatten partition-classes
@@ -329,7 +330,7 @@ M: object class>questions 1array ;
 : condition-states ( condition -- states )
     dup condition? [
         [ yes>> ] [ no>> ] bi
-        [ condition-states ] bi@ append prune
+        [ condition-states ] bi@ union
     ] [ 1array ] if ;
 
 : condition-at ( condition assoc -- new-condition )
index 70281aa798d38708f2d234265634cbe65d62c6fc..0025b89d56d8119912f5bad662d22a6c75396b5c 100644 (file)
@@ -27,7 +27,7 @@ ERROR: bad-class name ;
     [ [ simple ] keep ] H{ } map>assoc ;
 
 MEMO: simple-script-table ( -- table )
-    script-table interval-values prune simple-table ;
+    script-table interval-values members simple-table ;
 
 MEMO: simple-category-table ( -- table )
     categories simple-table ;
index bb6ae5cf2de51ce4839638f6ce081fcd51aba3f0..0d9375708686f3715264ca08ee42e776407fd946 100644 (file)
@@ -239,7 +239,7 @@ PRIVATE>
         dup class? [ dup seeing-implementors % ] when
         dup generic? [ dup seeing-methods % ] when
         drop
-    ] { } make prune ;
+    ] { } make members ;
 
 : see-methods ( word -- )
     methods see-all nl ;
index 88a64b7746592e0c218c8a7a0d4b6bdefcb5a00c..a2fa8c3c4c11e05d518a1863225e224a1d5aeb68 100644 (file)
@@ -47,7 +47,7 @@ SYMBOL: interned
     ] { } make <interval-map> ;
 
 : process-interval-file ( ranges -- table )
-    dup values prune interned
+    dup values members interned
     [ expand-ranges ] with-variable ;
 
 : load-interval-file ( filename -- table )
index 134c144fda07442be067257492139cfb21299452..8f728c1eda0d0541a7b460f266131a2bba7b4c6f 100644 (file)
@@ -35,5 +35,5 @@ SYNTAX: SA{ \ } [ >suffix-array ] parse-literal ;
 
 : query ( begin suffix-array -- matches )
     2dup find-index dup
-    [ -rot [ from-to ] keep <funky-slice> [ seq>> ] map prune ]
+    [ -rot [ from-to ] keep <funky-slice> [ seq>> ] map members ]
     [ 3drop { } ] if ;
index 73d4b919d596295bb43b7c4adee828f239d3cbdb..6fb6ab91ecef2e6daf648d99effb48204559af69 100755 (executable)
@@ -21,6 +21,7 @@ QUALIFIED: source-files.errors
 QUALIFIED: vocabs
 FROM: alien.libraries.private => >deployed-library-path ;
 FROM: namespaces => set ;
+FROM: sets => members ;
 IN: tools.deploy.shaker
 
 ! This file is some hairy shit.
@@ -507,7 +508,7 @@ SYMBOL: deploy-vocab
 : write-vocab-manifest ( vocab-manifest-out -- )
     "Writing vocabulary manifest to " write dup print flush
     vocabs "VOCABS:" prefix
-    deploy-libraries get [ libraries get at path>> ] map prune "LIBRARIES:" prefix append
+    deploy-libraries get [ libraries get at path>> ] map members "LIBRARIES:" prefix append
     swap utf8 set-file-lines ;
 
 : prepare-deploy-libraries ( -- )
index b0ce5dfbe4a173326386f7f68c9d1bf9d2134d70..c79d8b443c00799363ba63611c31335b7f7e4fef 100644 (file)
@@ -5,6 +5,7 @@ io io.styles namespaces assocs kernel.private strings
 combinators sorting math.parser vocabs definitions
 tools.profiler.private tools.crossref continuations generic
 compiler.units compiler.crossref sets classes fry ;
+FROM: sets => members ;
 IN: tools.profiler
 
 : profile ( quot -- )
@@ -41,7 +42,7 @@ IN: tools.profiler
     [ smart-usage [ word? ] filter ]
     [ generic-call-sites-of keys ]
     [ effect-dependencies-of keys ]
-    tri 3append prune ;
+    tri 3append members ;
 
 : usage-counters ( word -- alist )
     profiler-usage counters ;
index 30c96335cc12dcfe682f2ba8318f5cdba9608b98..6e8e73ab55ec5e8de65cff8436d7ad1ab9d82356 100644 (file)
@@ -6,6 +6,7 @@ math.vectors classes.tuple classes boxes calendar alarms combinators
 sets columns fry deques ui.gadgets ui.gadgets.private ascii
 combinators.short-circuit ;
 FROM: namespaces => set ;
+FROM: sets => members ;
 IN: ui.gestures
 
 : get-gesture-handler ( gesture gadget -- quot )
@@ -235,7 +236,7 @@ SYMBOL: drag-timer
 
 : modifier ( mod modifiers -- seq )
     [ second swap bitand 0 > ] with filter
-    0 <column> prune [ f ] [ >array ] if-empty ;
+    0 <column> members [ f ] [ >array ] if-empty ;
 
 : drag-loc ( -- loc )
     hand-loc get-global hand-click-loc get-global v- ;
index 824ffb8351ebffc04589197dbd8d07e515b0860e..bf32b329ceb111fd11bec2a5e7a33fed94082f01 100644 (file)
@@ -138,7 +138,7 @@ M: world ungraft*
         layout-queue [
             dup layout find-world [ , ] when*
         ] slurp-deque
-    ] { } make prune ;
+    ] { } make members ;
 
 : redraw-worlds ( seq -- )
     [ dup update-hand draw-world ] each ;
index 85b59de750416814c85613eb0a3507b991f5b177..ff4e64df295eccea8b43febcb10e484e8fd3a547 100644 (file)
@@ -184,7 +184,7 @@ C: <code-point> code-point
     ] assoc-map ;
 
 : properties>intervals ( properties -- assoc[str,interval] )
-    dup values prune [ f ] H{ } map>assoc
+    dup values members [ f ] H{ } map>assoc
     [ [ push-at ] curry assoc-each ] keep
     [ <interval-set> ] assoc-map ;
 
index 09ca012fcc0ed7f02bc6e597a2f7af402ae8bc42..5048b0edd065f880ac48a673df7a9bda9c82fc2c 100644 (file)
@@ -73,7 +73,7 @@ M: vocab-link summary vocab-summary ;
     dup vocab-tags-path set-vocab-file-contents ;
 
 : add-vocab-tags ( tags vocab -- )
-    [ vocab-tags append prune ] keep set-vocab-tags ;
+    [ vocab-tags append members ] keep set-vocab-tags ;
 
 : remove-vocab-tags ( tags vocab -- )
     [ vocab-tags swap diff ] keep set-vocab-tags ;
index 1bf73862e6b58b0da3dcff4cbe08a0c22d331df0..6274921bdb51f2462b8151ae501a650aba9c2c8b 100644 (file)
@@ -39,7 +39,7 @@ TR: convert-separators "/\\" ".." ;
 : monitor-thread ( -- )\r
     [\r
         [\r
-            vocab-roots get prune [ add-monitor-for-path ] each\r
+            vocab-roots get [ add-monitor-for-path ] each\r
 \r
             H{ } clone changed-vocabs set-global\r
             vocabs [ changed-vocab ] each\r
index 3dc67712dea31a6bb50293297c80640a38abba3e..3d9c91bbcd52beeead288bf03bc8f7651a41f8c6 100644 (file)
@@ -82,7 +82,7 @@ SYMBOL: modified-docs
         [ [ vocab f >>docs-loaded? drop ] each ] bi*
     ]
     [
-        append prune
+        union
         [ unchanged-vocabs ]
         [ require-all load-failures. ] bi
     ] 2bi ;
index 877eda44aa1f0d7da80f9fe4c6449f36bcac4479..402dd974b1eba8b86d01239226aa734bdd68a350 100644 (file)
@@ -32,7 +32,7 @@ M: keyword-map >alist
     assoc>> >alist ;
 
 : (keyword-map-no-word-sep) ( assoc -- str )
-    keys concat [ alpha? not ] filter prune natural-sort ;
+    keys combine [ alpha? not ] filter natural-sort ;
 
 : keyword-map-no-word-sep* ( keyword-map -- str )
     dup no-word-sep>> [ ] [
index 96fa34314ea06d836e17dc65f63b6ac5fbc98e5a..ae217904b75bc612df69a8faf1d69843e02de90b 100644 (file)
@@ -4,6 +4,7 @@ USING: kernel classes classes.private combinators accessors
 sequences arrays vectors assocs namespaces words sorting layouts
 math hashtables kernel.private sets math.order ;
 FROM: classes => members ;
+RENAME: members sets => set-members
 IN: classes.algebra
 
 <PRIVATE
@@ -11,13 +12,14 @@ IN: classes.algebra
 TUPLE: anonymous-union { members read-only } ;
 
 : <anonymous-union> ( members -- class )
-    [ null eq? not ] filter prune
+    [ null eq? not ] filter set-members
     dup length 1 = [ first ] [ anonymous-union boa ] if ;
 
 TUPLE: anonymous-intersection { participants read-only } ;
 
 : <anonymous-intersection> ( participants -- class )
-    prune dup length 1 = [ first ] [ anonymous-intersection boa ] if ;
+    set-members dup length 1 =
+    [ first ] [ anonymous-intersection boa ] if ;
 
 TUPLE: anonymous-complement { class read-only } ;
 
index 5e7c3b1617b7e6b4a709d425ada04e3e1ba7167d..5274c07d37d63fd04a11132b2dd84516a8a39014 100644 (file)
@@ -105,7 +105,6 @@ M: sequence all-unique?
 
 ! Temporarily for compatibility
 
-ALIAS: prune members
 : unique ( seq -- assoc )
     [ dup ] H{ } map>assoc ;
 : conjoin ( elt assoc -- )
index 97f4edc521f5de13c2feaaa309c62334c58221d5..1ca62beef396e8050d9e9e3232ef021e4b7336a0 100644 (file)
@@ -11,7 +11,7 @@ IN: contributors
     ] with-directory ;
 
 : patch-counts ( authors -- assoc )
-    dup prune
+    dup members
     [ dup rot [ = ] with count ] with
     { } map>assoc ;
 
index 39ba3bd2b3c286d45c8f4e0a19e4d56bcb286f46..649081ff03f1c80ea5626347ec949d4e25e59d38 100644 (file)
@@ -29,7 +29,7 @@ IN: fuel.xref
     [ word? ] filter [ word>xref ] map ;
 
 : filter-prefix ( seq prefix -- seq )
-    [ drop-prefix nip length 0 = ] curry filter prune ;
+    [ drop-prefix nip length 0 = ] curry filter members ;
 
 MEMO: (vocab-words) ( name -- seq )
     >vocab-link words [ name>> ] map ;
@@ -40,7 +40,7 @@ MEMO: (vocab-words) ( name -- seq )
     append H{ } [ assoc-union ] reduce keys ;
 
 : vocabs-words ( names -- seq )
-    prune [ (vocab-words) ] map concat ;
+    members [ (vocab-words) ] map concat ;
 
 PRIVATE>
 
index 2d0b9514ffee2dab36a0c2569a32df11cb9e6dbd..760fd1e47be71078b531f1a051a03d4ba0bbc396 100644 (file)
@@ -145,7 +145,7 @@ TUPLE: link attributes clickable ;
     [ >url ] map ;
 
 : find-all-links ( vector -- vector' )
-    [ find-hrefs ] [ find-frame-links ] bi append prune ;
+    [ find-hrefs ] [ find-frame-links ] bi union ;
 
 : find-forms ( vector -- vector' )
     "form" over find-opening-tags-by-name
index 81086e806427012946fe67886d3b4a2805be2f4a..58c90df6e9438d3cbecf5f8580603d14efaa07ae 100644 (file)
@@ -79,11 +79,8 @@ SYMBOL: terms
         [ nth ] 2keep swap 1 + tail-slice (inversions) +
     ] curry each ;
 
-: duplicates? ( seq -- ? )
-    dup prune [ length ] bi@ > ;
-
 : (wedge) ( n basis1 basis2 -- n basis )
-    append dup duplicates? [
+    append dup all-unique? not [
         2drop 0 { }
     ] [
         dup permutation inversions -1^ rot *
index bd703d3cb9247fc0af936bcd82c81e9bb6e9953a..8593e4741313b65e18d30275f4a1c4a7312022a7 100644 (file)
@@ -23,7 +23,7 @@ M: method word-vocabulary "method-generic" word-prop word-vocabulary ;
 :: do-step ( errors summary-file details-file -- )
     errors
     [ error-type +linkage-error+ eq? not ] filter
-    [ file>> ] map prune natural-sort summary-file to-file
+    [ file>> ] map members natural-sort summary-file to-file
     errors details-file utf8 [ errors. ] with-file-writer ;
 
 : do-tests ( -- )
@@ -55,7 +55,7 @@ M: method word-vocabulary "method-generic" word-prop word-vocabulary ;
     "" to-refresh drop 2dup [ empty? not ] either?
     [
         "Boot image is out of date. Changed vocabs:" print
-        append prune [ print ] each
+        members [ print ] each
         flush
         1 exit
     ] [ 2drop ] if ;
index 1bb9ebbef5751c420ac741e523c4b70ad5694dc7..342e8d1a9edde3b95cdb33431cec84cc1408e039 100644 (file)
@@ -29,7 +29,7 @@ IN: project-euler.004
 PRIVATE>
 
 : euler004 ( -- answer )
-    source-004 dup [ * ] cartesian-map concat prune max-palindrome ;
+    source-004 dup [ * ] cartesian-map combine max-palindrome ;
 
 ! [ euler004 ] 100 ave-time
 ! 1164 ms ave run time - 39.35 SD (100 trials)
index 31be1a566b5bc09e847438bfc68f996d5f74fe89..944d345938edaa51be30ff726224ec204279aad9 100644 (file)
@@ -29,7 +29,7 @@ IN: project-euler.029
 ! --------
 
 : euler029 ( -- answer )
-    2 100 [a,b] dup [ ^ ] cartesian-map concat prune length ;
+    2 100 [a,b] dup [ ^ ] cartesian-map concat members length ;
 
 ! [ euler029 ] 100 ave-time
 ! 704 ms ave run time - 28.07 SD (100 trials)
index 7def55b659868755dc53212bf7d72f49bff18d18..de0cb72609faf3bb0f1d0755d97b32af09289b51 100644 (file)
@@ -48,7 +48,7 @@ IN: project-euler.032
 PRIVATE>
 
 : euler032 ( -- answer )
-    source-032 [ valid? ] filter products prune sum ;
+    source-032 [ valid? ] filter products members sum ;
 
 ! [ euler032 ] 10 ave-time
 ! 16361 ms ave run time - 417.8 SD (10 trials)
@@ -72,7 +72,7 @@ PRIVATE>
     50 [1,b] 2000 [1,b]
     [ mmp ] cartesian-map concat
     [ pandigital? ] filter
-    products prune sum ;
+    products members sum ;
 
 ! [ euler032a ] 10 ave-time
 ! 2624 ms ave run time - 131.91 SD (10 trials)
index 1fb5c7c8bbd8328b3ade34d079d0853441387e71..306746b601f667adf60016ae519281bf7f4c296d 100644 (file)
@@ -70,7 +70,7 @@ INSTANCE: rollover immutable-sequence
     over length <rollover> swap [ bitxor ] 2map ;
 
 : frequency-analysis ( seq -- seq )
-    dup prune [
+    dup members [
         [ 2dup [ = ] curry count 2array , ] each
     ] { } make nip ; inline
 
index 3ad740670312e4462f25d2bc0c3b7fe0cec156ec..e0a616dc52f1dbbc91a52ce1d648295e21bfd3a8 100644 (file)
@@ -35,7 +35,7 @@ IN: project-euler.079
     ] { } make ;
 
 : find-source ( seq -- elt )
-    unzip diff prune
+    unzip diff
     [ "Topological sort failed" throw ] [ first ] if-empty ;
 
 : remove-source ( seq elt -- seq )
@@ -52,7 +52,7 @@ PRIVATE>
 
 : topological-sort ( seq -- seq )
     [ [ (topological-sort) ] { } make ] keep
-    concat prune over diff append ;
+    combine over diff append ;
 
 : euler079 ( -- answer )
     source-079 >edges topological-sort 10 digits>integer ;
@@ -60,7 +60,7 @@ PRIVATE>
 ! [ euler079 ] 100 ave-time
 ! 1 ms ave run time - 0.46 SD (100 trials)
 
-! TODO: prune and diff are relatively slow; topological sort could be
+! TODO: set words on sequences are relatively slow; topological sort could be
 ! cleaned up and generalized much better, but it works for this problem
 
 SOLUTION: euler079
index 806098b865ebea4754e88b3c9be2226377870306..2077fe328e51b2267aadddf79095d902ee0d83a3 100644 (file)
@@ -45,7 +45,7 @@ IN: project-euler.203
     [ 0 prefix ] [ 0 suffix ] bi [ + ] 2map ;
 
 : generate ( n -- seq )
-    1 - { 1 } [ (generate) ] iterate concat prune ;
+    1 - { 1 } [ (generate) ] iterate combine ;
 
 : squarefree ( n -- ? )
     factors all-unique? ;
index c8ea4734d28a79294a182ecd33c04d9bcc57f2e7..2a0b2946e5536ede02ba8989ffba916e2f519947 100644 (file)
@@ -48,7 +48,7 @@ fetched-in parsed-html links processed-in fetched-at ;
     nonmatching>> push-links ;
 
 : filter-base-links ( spider spider-result -- base-links nonmatching-links )
-    [ base>> host>> ] [ links>> prune ] bi*
+    [ base>> host>> ] [ links>> members ] bi*
     [ host>> = ] with partition ;
 
 : add-spidered ( spider spider-result -- )