]> gitweb.factorcode.org Git - factor.git/commitdiff
Final changes for deques rename
authorDaniel Ehrenberg <littledan@Macintosh-103.local>
Thu, 21 Aug 2008 20:11:28 +0000 (22:11 +0200)
committerDaniel Ehrenberg <littledan@Macintosh-103.local>
Thu, 21 Aug 2008 20:11:28 +0000 (22:11 +0200)
12 files changed:
basis/dequeues/authors.txt [deleted file]
basis/dequeues/dequeues-docs.factor [deleted file]
basis/dequeues/dequeues.factor [deleted file]
basis/dequeues/summary.txt [deleted file]
basis/dequeues/tags.txt [deleted file]
basis/persistent/deques/deques-docs.factor
basis/search-dequeues/authors.txt [deleted file]
basis/search-dequeues/search-dequeues-docs.factor [deleted file]
basis/search-dequeues/search-dequeues-tests.factor [deleted file]
basis/search-dequeues/search-dequeues.factor [deleted file]
basis/search-dequeues/summary.txt [deleted file]
basis/search-dequeues/tags.txt [deleted file]

diff --git a/basis/dequeues/authors.txt b/basis/dequeues/authors.txt
deleted file mode 100644 (file)
index 1901f27..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Slava Pestov
diff --git a/basis/dequeues/dequeues-docs.factor b/basis/dequeues/dequeues-docs.factor
deleted file mode 100644 (file)
index 25cc969..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-IN: dequeues
-USING: help.markup help.syntax kernel ;
-
-ARTICLE: "dequeues" "Dequeues"
-"A dequeue is a data structure with constant-time insertion and removal of elements at both ends. Dequeue operations are defined in the " { $vocab-link "dequeues" } " vocabulary."
-$nl
-"Dequeues must be instances of a mixin class:"
-{ $subsection dequeue }
-"Dequeues must implement a protocol."
-$nl
-"Querying the dequeue:"
-{ $subsection peek-front }
-{ $subsection peek-back }
-{ $subsection dequeue-length }
-{ $subsection dequeue-member? }
-"Adding and removing elements:"
-{ $subsection push-front* }
-{ $subsection push-back* }
-{ $subsection pop-front* }
-{ $subsection pop-back* }
-{ $subsection clear-dequeue }
-"Working with node objects output by " { $link push-front* } " and " { $link push-back* } ":"
-{ $subsection delete-node }
-{ $subsection node-value }
-"Utility operations built in terms of the above:"
-{ $subsection dequeue-empty? }
-{ $subsection push-front }
-{ $subsection push-all-front }
-{ $subsection push-back }
-{ $subsection push-all-back }
-{ $subsection pop-front }
-{ $subsection pop-back }
-{ $subsection slurp-dequeue }
-"When using a dequeue as a queue, the convention is to queue elements with " { $link push-front } " and dequeue them with " { $link pop-back } "." ;
-
-ABOUT: "dequeues"
-
-HELP: dequeue-empty?
-{ $values { "dequeue" { $link dequeue } } { "?" "a boolean" } }
-{ $description "Returns true if a dequeue is empty." }
-{ $notes "This operation is O(1)." } ;
-
-HELP: push-front
-{ $values { "obj" object } { "dequeue" dequeue } }
-{ $description "Push the object onto the front of the dequeue." } 
-{ $notes "This operation is O(1)." } ;
-
-HELP: push-front*
-{ $values { "obj" object } { "dequeue" dequeue } { "node" "a node" } }
-{ $description "Push the object onto the front of the dequeue and return the newly created node." } 
-{ $notes "This operation is O(1)." } ;
-
-HELP: push-back
-{ $values { "obj" object } { "dequeue" dequeue } }
-{ $description "Push the object onto the back of the dequeue." } 
-{ $notes "This operation is O(1)." } ;
-
-HELP: push-back*
-{ $values { "obj" object } { "dequeue" dequeue } { "node" "a node" } }
-{ $description "Push the object onto the back of the dequeue and return the newly created node." } 
-{ $notes "This operation is O(1)." } ;
-
-HELP: peek-front
-{ $values { "dequeue" dequeue } { "obj" object } }
-{ $description "Returns the object at the front of the dequeue." } ;
-
-HELP: pop-front
-{ $values { "dequeue" dequeue } { "obj" object } }
-{ $description "Pop the object off the front of the dequeue and return the object." }
-{ $notes "This operation is O(1)." } ;
-
-HELP: pop-front*
-{ $values { "dequeue" dequeue } }
-{ $description "Pop the object off the front of the dequeue." }
-{ $notes "This operation is O(1)." } ;
-
-HELP: peek-back
-{ $values { "dequeue" dequeue } { "obj" object } }
-{ $description "Returns the object at the back of the dequeue." } ;
-
-HELP: pop-back
-{ $values { "dequeue" dequeue } { "obj" object } }
-{ $description "Pop the object off the back of the dequeue and return the object." }
-{ $notes "This operation is O(1)." } ;
-
-HELP: pop-back*
-{ $values { "dequeue" dequeue } }
-{ $description "Pop the object off the back of the dequeue." }
-{ $notes "This operation is O(1)." } ;
diff --git a/basis/dequeues/dequeues.factor b/basis/dequeues/dequeues.factor
deleted file mode 100644 (file)
index ae55c57..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-! Copyright (C) 2008 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel sequences math ;
-IN: dequeues
-
-GENERIC: push-front* ( obj dequeue -- node )
-GENERIC: push-back* ( obj dequeue -- node )
-GENERIC: peek-front ( dequeue -- obj )
-GENERIC: peek-back ( dequeue -- obj )
-GENERIC: pop-front* ( dequeue -- )
-GENERIC: pop-back* ( dequeue -- )
-GENERIC: delete-node ( node dequeue -- )
-GENERIC: dequeue-length ( dequeue -- n )
-GENERIC: dequeue-member? ( value dequeue -- ? )
-GENERIC: clear-dequeue ( dequeue -- )
-GENERIC: node-value ( node -- value )
-
-: dequeue-empty? ( dequeue -- ? )
-    dequeue-length zero? ;
-
-: push-front ( obj dequeue -- )
-    push-front* drop ;
-
-: push-all-front ( seq dequeue -- )
-    [ push-front ] curry each ;
-
-: push-back ( obj dequeue -- )
-    push-back* drop ;
-
-: push-all-back ( seq dequeue -- )
-    [ push-back ] curry each ;
-
-: pop-front ( dequeue -- obj )
-    [ peek-front ] [ pop-front* ] bi ;
-
-: pop-back ( dequeue -- obj )
-    [ peek-back ] [ pop-back* ] bi ;
-
-: slurp-dequeue ( dequeue quot -- )
-    [ drop [ dequeue-empty? not ] curry ]
-    [ [ pop-back ] prepose curry ] 2bi [ ] while ; inline
-
-MIXIN: dequeue
diff --git a/basis/dequeues/summary.txt b/basis/dequeues/summary.txt
deleted file mode 100644 (file)
index 2f348eb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Double-ended queue protocol and common operations
diff --git a/basis/dequeues/tags.txt b/basis/dequeues/tags.txt
deleted file mode 100644 (file)
index 42d711b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-collections
index 56ee46a6a9ac7313bdf1996a3048aaf41e7f8633..43018bed163b2ee92a8b8dcb88f185fc2324ddec 100644 (file)
@@ -2,7 +2,7 @@ USING: help.markup help.syntax kernel sequences ;
 IN: persistent.deques
 
 ARTICLE: "persistent.deques" "Persistent deques"
-"A deque is a data structure that can be used as both a queue and a stack. That is, there are two ends, the left and the right, and values can be pushed onto and popped off of both ends. These operations take O(1) amortized time and space in a normal usage pattern."
+"A deque is a data structure that can be used as both a queue and a stack. That is, there are two ends, the front and the back, and values can be pushed onto and popped off of both ends. These operations take O(1) amortized time and space in a normal usage pattern."
 $nl
 "This vocabulary provides a deque implementation which is persistent and purely functional: old versions of deques are not modified by operations. Instead, each push and pop operation creates a new deque based off the old one."
 $nl
@@ -14,10 +14,10 @@ $nl
 "To test if a deque is empty:"
 { $subsection deque-empty? }
 "To manipulate deques:"
-{ $subsection push-left }
-{ $subsection push-right }
-{ $subsection pop-left }
-{ $subsection pop-right }
+{ $subsection push-front }
+{ $subsection push-back }
+{ $subsection pop-front }
+{ $subsection pop-back }
 { $subsection deque>sequence } ;
 
 HELP: deque
@@ -29,28 +29,28 @@ HELP: <deque>
 
 HELP: sequence>deque
 { $values { "sequence" sequence } { "deque" deque } }
-{ $description "Given a sequence, creates a deque containing those elements in the order such that the beginning of the sequence is on the left and the end is on the right." } ;
+{ $description "Given a sequence, creates a deque containing those elements in the order such that the beginning of the sequence is on the front and the end is on the back." } ;
 
 HELP: deque>sequence
 { $values { "deque" deque } { "sequence" sequence } }
-{ $description "Given a deque, creates a sequence containing those elements, such that the left side of the deque is the beginning of the sequence." } ;
+{ $description "Given a deque, creates a sequence containing those elements, such that the front side of the deque is the beginning of the sequence." } ;
 
 HELP: deque-empty?
 { $values { "deque" deque } { "?" "t/f" } }
 { $description "Returns true if the deque is empty. This takes constant time." } ;
 
-HELP: push-left
+HELP: push-front
 { $values { "deque" deque } { "item" object } { "newdeque" deque } }
-{ $description "Creates a new deque with the given object pushed onto the left side. This takes constant time." } ;
+{ $description "Creates a new deque with the given object pushed onto the front side. This takes constant time." } ;
 
-HELP: push-right
+HELP: push-back
 { $values { "deque" deque } { "item" object } { "newdeque" deque } }
-{ $description "Creates a new deque with the given object pushed onto the right side. This takes constant time." } ;
+{ $description "Creates a new deque with the given object pushed onto the back side. This takes constant time." } ;
 
-HELP: pop-left
+HELP: pop-front
 { $values { "deque" object } { "item" object } { "newdeque" deque } }
-{ $description "Creates a new deque with the leftmost item removed. This takes amortized constant time with single-threaded access." } ;
+{ $description "Creates a new deque with the frontmost item removed. This takes amortized constant time with single-threaded access." } ;
 
-HELP: pop-right
+HELP: pop-back
 { $values { "deque" object } { "item" object } { "newdeque" deque } }
-{ $description "Creates a new deque with the rightmost item removed. This takes amortized constant time with single-threaded access." } ;
+{ $description "Creates a new deque with the backmost item removed. This takes amortized constant time with single-threaded access." } ;
diff --git a/basis/search-dequeues/authors.txt b/basis/search-dequeues/authors.txt
deleted file mode 100644 (file)
index 1901f27..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Slava Pestov
diff --git a/basis/search-dequeues/search-dequeues-docs.factor b/basis/search-dequeues/search-dequeues-docs.factor
deleted file mode 100644 (file)
index de9e9f0..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-IN: search-dequeues
-USING: help.markup help.syntax kernel dlists hashtables
-dequeues assocs ;
-
-ARTICLE: "search-dequeues" "Search dequeues"
-"A search dequeue is a data structure with constant-time insertion and removal of elements at both ends, and constant-time membership tests. Inserting an element more than once has no effect. Search dequeues implement all dequeue operations in terms of an underlying dequeue, and membership testing with " { $link dequeue-member? } " is implemented with an underlying assoc. Search dequeues are defined in the " { $vocab-link "search-dequeues" } " vocabulary."
-$nl
-"Creating a search dequeue:"
-{ $subsection <search-dequeue> }
-"Default implementation:"
-{ $subsection <hashed-dlist> } ;
-
-ABOUT: "search-dequeues"
-
-HELP: <search-dequeue> ( assoc dequeue -- search-dequeue )
-{ $values { "assoc" assoc } { "dequeue" dequeue } { "search-dequeue" search-dequeue } }
-{ $description "Creates a new " { $link search-dequeue } "." } ;
-
-HELP: <hashed-dlist> ( -- search-dequeue )
-{ $values { "search-dequeue" search-dequeue } }
-{ $description "Creates a new " { $link search-dequeue } " backed by a " { $link dlist } ", with a " { $link hashtable } " for fast membership tests." } ;
diff --git a/basis/search-dequeues/search-dequeues-tests.factor b/basis/search-dequeues/search-dequeues-tests.factor
deleted file mode 100644 (file)
index acf929d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-IN: search-dequeues.tests
-USING: search-dequeues tools.test namespaces
-kernel sequences words dequeues vocabs ;
-
-<hashed-dlist> "h" set
-
-[ t ] [ "h" get dequeue-empty? ] unit-test
-
-[ ] [ 3 "h" get push-front* "1" set ] unit-test
-[ ] [ 1 "h" get push-front ] unit-test
-[ ] [ 3 "h" get push-front* "2" set ] unit-test
-[ ] [ 3 "h" get push-front* "3" set ] unit-test
-[ ] [ 7 "h" get push-front ] unit-test
-
-[ t ] [ "1" get "2" get eq? ] unit-test
-[ t ] [ "2" get "3" get eq? ] unit-test
-
-[ 3 ] [ "h" get dequeue-length ] unit-test
-[ t ] [ 7 "h" get dequeue-member? ] unit-test
-
-[ 3 ] [ "1" get node-value ] unit-test
-[ ] [ "1" get "h" get delete-node ] unit-test
-
-[ 2 ] [ "h" get dequeue-length ] unit-test
-[ 1 ] [ "h" get pop-back ] unit-test
-[ 7 ] [ "h" get pop-back ] unit-test
-
-[ f ] [ 7 "h" get dequeue-member? ] unit-test
-
-[ ] [
-    <hashed-dlist>
-    [ all-words swap [ push-front ] curry each ]
-    [ [ drop ] slurp-dequeue ]
-    bi
-] unit-test
diff --git a/basis/search-dequeues/search-dequeues.factor b/basis/search-dequeues/search-dequeues.factor
deleted file mode 100644 (file)
index 87c997a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-! Copyright (C) 2008 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel assocs dequeues dlists hashtables ;
-IN: search-dequeues
-
-TUPLE: search-dequeue assoc dequeue ;
-
-C: <search-dequeue> search-dequeue
-
-: <hashed-dlist> ( -- search-dequeue )
-    0 <hashtable> <dlist> <search-dequeue> ;
-
-M: search-dequeue dequeue-length dequeue>> dequeue-length ;
-
-M: search-dequeue peek-front dequeue>> peek-front ;
-
-M: search-dequeue peek-back dequeue>> peek-back ;
-
-M: search-dequeue push-front*
-    2dup assoc>> at* [ 2nip ] [
-        drop
-        [ dequeue>> push-front* ] [ assoc>> ] 2bi
-        [ 2drop ] [ set-at ] 3bi
-    ] if ;
-
-M: search-dequeue push-back*
-    2dup assoc>> at* [ 2nip ] [
-        drop
-        [ dequeue>> push-back* ] [ assoc>> ] 2bi
-        [ 2drop ] [ set-at ] 3bi
-    ] if ;
-
-M: search-dequeue pop-front*
-    [ [ dequeue>> peek-front ] [ assoc>> ] bi delete-at ]
-    [ dequeue>> pop-front* ]
-    bi ;
-
-M: search-dequeue pop-back*
-    [ [ dequeue>> peek-back ] [ assoc>> ] bi delete-at ]
-    [ dequeue>> pop-back* ]
-    bi ;
-
-M: search-dequeue delete-node
-    [ dequeue>> delete-node ]
-    [ [ node-value ] [ assoc>> ] bi* delete-at ] 2bi ;
-
-M: search-dequeue clear-dequeue
-    [ dequeue>> clear-dequeue ] [ assoc>> clear-assoc ] bi ;
-
-M: search-dequeue dequeue-member?
-    assoc>> key? ;
-
-INSTANCE: search-dequeue dequeue
diff --git a/basis/search-dequeues/summary.txt b/basis/search-dequeues/summary.txt
deleted file mode 100644 (file)
index 9102bf2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Double-ended queues with sub-linear membership testing
diff --git a/basis/search-dequeues/tags.txt b/basis/search-dequeues/tags.txt
deleted file mode 100644 (file)
index 42d711b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-collections