]> gitweb.factorcode.org Git - factor.git/commitdiff
Making all of basis and extra unambiguous for sets/namespaces
authorDaniel Ehrenberg <littledan@Macintosh-122.local>
Fri, 26 Feb 2010 21:28:38 +0000 (16:28 -0500)
committerDaniel Ehrenberg <littledan@Macintosh-122.local>
Fri, 26 Feb 2010 21:28:38 +0000 (16:28 -0500)
basis/compiler/cfg/linear-scan/debugger/debugger.factor
basis/farkup/farkup.factor
basis/smtp/smtp.factor
basis/xml/elements/elements.factor
core/new-sets/new-sets-tests.factor [deleted file]
core/new-sets/new-sets.factor [deleted file]
extra/koszul/koszul.factor
extra/managed-server/chat/chat.factor
extra/managed-server/managed-server.factor
extra/multi-methods/multi-methods.factor
extra/project-euler/051/051.factor

index fa248dd4e8e99f956bfdaa9b1944a6e595c1d5c5..d93ebcccf07d6c1bc8eec497d9ef12fed06d2f51 100644 (file)
@@ -3,6 +3,7 @@
 USING: accessors kernel sequences sets arrays math strings fry
 namespaces prettyprint compiler.cfg.linear-scan.live-intervals
 compiler.cfg.linear-scan.allocation compiler.cfg assocs ;
+FROM: namespaces => set ;
 IN: compiler.cfg.linear-scan.debugger
 
 : check-linear-scan ( live-intervals machine-registers -- )
index 57954385706ed1a007bb0e0b1f8803eb6bab31c9..fe9bc78ec622014de5f6cf007e5db703f49c208b 100644 (file)
@@ -4,6 +4,7 @@ USING: sequences kernel splitting lists fry accessors assocs math.order
 math combinators namespaces urls.encoding xml.syntax xmode.code2html
 xml.data arrays strings vectors xml.writer io.streams.string locals
 unicode.categories ;
+FROM: namespaces => set ;
 IN: farkup
 
 SYMBOL: relative-link-prefix
index 61ccd5c435c1d7401578927f2cdcd4ed1397d729..045c08df42b86056fec8e5ccd13f35e1585e1b66 100644 (file)
@@ -7,6 +7,7 @@ io.encodings.ascii io.timeouts io.sockets io.sockets.secure io.crlf
 kernel logging sequences combinators splitting assocs strings
 math.order math.parser random system calendar summary calendar.format
 accessors sets hashtables base64 debugger classes prettyprint words ;
+FROM: namespaces => set ;
 IN: smtp
 
 SYMBOL: smtp-domain
index b927947329a49388bd8c859f0d045ae36195b9e4..1e59c199091ce90705359a5640c63c23c7a9ce33 100644 (file)
@@ -4,6 +4,7 @@ USING: kernel namespaces xml.tokenize xml.state xml.name
 xml.data accessors arrays make xml.char-classes fry assocs sequences
 math xml.errors sets combinators io.encodings io.encodings.iana
 unicode.case xml.dtd strings xml.entities unicode.categories ;
+FROM: namespaces => set ;
 IN: xml.elements
 
 : take-interpolated ( quot -- interpolated )
diff --git a/core/new-sets/new-sets-tests.factor b/core/new-sets/new-sets-tests.factor
deleted file mode 100644 (file)
index b644b9a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-! Copyright (C) 2010 Daniel Ehrenberg
-! See http://factorcode.org/license.txt for BSD license.
-USING: new-sets tools.test kernel prettyprint hash-sets sorting ;
-IN: new-sets.tests
-
-[ { } ] [ { } { } intersect  ] unit-test
-[ { 2 3 } ] [ { 1 2 3 } { 2 3 4 } intersect ] unit-test
-
-[ { } ] [ { } { } diff ] unit-test
-[ { 1 } ] [ { 1 2 3 } { 2 3 4 } diff ] unit-test
-
-[ { } ] [ { } { } union ] unit-test
-[ { 1 2 3 4 } ] [ { 1 2 3 } { 2 3 4 } union ] unit-test
-
-[ t ] [ { 1 2 } { 1 3 } intersects? ] unit-test
-
-[ f ] [ { 4 2 } { 1 3 } intersects? ] unit-test
-
-[ f ] [ { } { 1 } intersects? ] unit-test
-
-[ f ] [ { 1 } { } intersects? ] unit-test
-
-[ t ] [ 4 { 2 4 5 } in? ] unit-test
-[ f ] [ 1 { 2 4 5 } in? ] unit-test
-
-[ V{ 1 2 3 } ] [ 3 V{ 1 2 } clone [ adjoin ] keep ] unit-test
-[ V{ 1 2 } ] [ 2 V{ 1 2 } clone [ adjoin ] keep ] unit-test
-[ V{ 1 2 } ] [ 3 V{ 1 2 } clone [ delete ] keep ] unit-test
-[ V{ 2 } ] [ 1 V{ 1 2 } clone [ delete ] keep ] unit-test
-
-[ t ] [ { 1 2 3 } { 2 1 3 } set= ] unit-test
-[ f ] [ { 2 3 } { 1 2 3 } set= ] unit-test
-[ f ] [ { 1 2 3 } { 2 3 } set= ] unit-test
-
-[ { 1 } ] [ { 1 } members ] unit-test
-
-[ { 1 2 3 } ] [ { 1 1 1 2 2 3 3 3 3 3 } dup set-like natural-sort ] unit-test
-[ { 1 2 3 } ] [ HS{ 1 2 3 } { } set-like natural-sort ] unit-test
-
-[ HS{ 1 2 3 } ] [ { 1 2 3 } fast-set ] unit-test
-
-[ { 1 2 3 } ] [ { { 1 } { 2 } { 1 3 } } combine ] unit-test
-
-[ f ] [ { 0 1 1 2 3 5 } all-unique? ] unit-test
-[ t ] [ { 0 1 2 3 4 5 } all-unique? ] unit-test
-
-[ { 1 2 3 } ] [ { 1 2 2 3 3 } { } set-like ] unit-test
-[ { 3 2 1 } ] [ { 3 3 2 2 1 } { } set-like ] unit-test
-
-[ { 2 1 2 1 } ] [ { 1 2 3 2 1 2 1 } duplicates ] unit-test
-[ f ] [ HS{ 1 2 3 1 2 1 } duplicates ] unit-test
-
-[ H{ { 3 HS{ 1 2 } } } ] [ H{ } clone 1 3 pick adjoin-at 2 3 pick adjoin-at ] unit-test
diff --git a/core/new-sets/new-sets.factor b/core/new-sets/new-sets.factor
deleted file mode 100644 (file)
index bc4e720..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-! Copyright (C) 2010 Daniel Ehrenberg
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs hashtables kernel vectors
-math sequences ;
-IN: new-sets
-
-! Set protocol
-MIXIN: set
-GENERIC: adjoin ( elt set -- )
-GENERIC: in? ( elt set -- ? )
-GENERIC: delete ( elt set -- )
-GENERIC: set-like ( set exemplar -- set' )
-GENERIC: fast-set ( set -- set' )
-GENERIC: members ( set -- sequence )
-GENERIC: union ( set1 set2 -- set )
-GENERIC: intersect ( set1 set2 -- set )
-GENERIC: intersects? ( set1 set2 -- ? )
-GENERIC: diff ( set1 set2 -- set )
-GENERIC: subset? ( set1 set2 -- ? )
-GENERIC: set= ( set1 set2 -- ? )
-GENERIC: duplicates ( set -- sequence )
-GENERIC: all-unique? ( set -- ? )
-
-! Defaults for some methods.
-! Override them for efficiency
-
-M: set union
-    [ [ members ] bi@ append ] keep set-like ;
-
-<PRIVATE
-
-: tester ( set -- quot )
-    fast-set [ in? ] curry ; inline
-
-: sequence/tester ( set1 set2 -- set1' quot )
-    [ members ] [ tester ] bi* ; inline
-
-PRIVATE>
-
-M: set intersect
-    [ sequence/tester filter ] keep set-like ;
-
-M: set diff
-    [ sequence/tester [ not ] compose filter ] keep set-like ;
-
-M: set intersects?
-    sequence/tester any? ;
-
-M: set subset?
-    sequence/tester all? ;
-    
-M: set set=
-    2dup subset? [ swap subset? ] [ 2drop f ] if ;
-
-M: set fast-set ;
-
-M: set duplicates drop f ;
-
-M: set all-unique? drop t ;
-
-<PRIVATE
-
-: (prune) ( elt hash vec -- )
-    3dup drop in? [ 3drop ] [
-        [ drop adjoin ] [ nip push ] 3bi
-    ] if ; inline
-
-: prune ( seq -- newseq )
-    [ f fast-set ] [ length <vector> ] bi
-    [ [ (prune) ] 2curry each ] keep ;
-
-PRIVATE>
-
-! Sequences are sets
-INSTANCE: sequence set
-
-M: sequence in?
-    member? ; inline
-
-M: sequence adjoin
-    [ delete ] [ push ] 2bi ;
-
-M: sequence delete
-    remove! drop ; inline
-
-M: sequence set-like
-    [ members ] dip like ;
-
-M: sequence members
-    [ prune ] keep like ;
-
-M: sequence all-unique?
-    dup prune sequence= ;
-
-! Some sequence methods are defined using hash-sets
-USE: vocabs.loader
-"hash-sets" require
-
-: combine ( sets -- set )
-    f [ union ] reduce ;
-
-: gather ( seq quot -- newseq )
-    map concat members ; inline
-
-: adjoin-at ( value key assoc -- )
-    [ [ f fast-set ] unless* [ adjoin ] keep ] change-at ;
index c35ba6ac8c0193922ba85c8b53879987713a6b64..81086e806427012946fe67886d3b4a2805be2f4a 100644 (file)
@@ -4,6 +4,7 @@ USING: accessors arrays hashtables assocs io kernel locals math
 math.vectors math.matrices math.matrices.elimination namespaces
 parser prettyprint sequences words combinators math.parser
 splitting sorting shuffle sets math.order ;
+FROM: namespaces => set ;
 IN: koszul
 
 ! Utilities
index e75a2803e689fd2863304b1e34cf277348b334eb..ecf36bcfbb74c974baf5cbc4e19b505844087023 100644 (file)
@@ -5,6 +5,7 @@ destructors fry io io.encodings.utf8 kernel managed-server
 namespaces parser sequences sorting splitting strings.parser
 unicode.case unicode.categories calendar calendar.format
 locals io.encodings.binary io.encodings.string prettyprint ;
+FROM: namespaces => set ;
 IN: managed-server.chat
 
 TUPLE: chat-server < managed-server ;
index 6f9bdf25f109007eac438e0afc760e762809d605..acb3c848252c6ea81503ea70e92b8b8b000e2a97 100644 (file)
@@ -5,6 +5,7 @@ io.encodings.binary io.servers.connection io.sockets
 io.streams.duplex fry kernel locals math math.ranges multiline
 namespaces prettyprint random sequences sets splitting threads
 tools.continuations ;
+FROM: namespaces => set ;
 IN: managed-server
 
 TUPLE: managed-server < threaded-server clients ;
index caf37dbadbf7cc1e55ee413ad02e86e86b3b3765..a65e459a7c58c22f4644c66d00a3768d536e61e7 100644 (file)
@@ -6,6 +6,7 @@ definitions prettyprint prettyprint.backend prettyprint.custom
 quotations generalizations debugger io compiler.units
 kernel.private effects accessors hashtables sorting shuffle
 math.order sets see effects.parser ;
+FROM: namespaces => set ;
 IN: multi-methods
 
 ! PART I: Converting hook specializers
index ff45e9e58a031552dc6650b3add204d1b957272e..f0bdd69901e1fc26bb75c54caa4e0db5118e776c 100644 (file)
@@ -29,6 +29,7 @@
 USING: assocs kernel math math.combinatorics math.functions
 math.parser math.primes namespaces project-euler.common
 sequences sets strings grouping math.ranges arrays fry math.order ;
+FROM: namespaces => set ;
 IN: project-euler.051
 <PRIVATE
 SYMBOL: family-count