From 220dd88a2ca6d2b7cac84d54773cb055cf253411 Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Fri, 19 Feb 2010 12:31:52 +1300
Subject: [PATCH 01/13] Update documentation for new help lint check

---
 basis/calendar/calendar-docs.factor           |  6 +--
 basis/calendar/calendar.factor                |  6 +--
 basis/compression/lzw/lzw-docs.factor         |  2 -
 basis/db/tuples/tuples-docs.factor            |  2 +-
 basis/db/tuples/tuples.factor                 |  2 +-
 basis/dlists/dlists-docs.factor               |  2 +-
 basis/dlists/dlists.factor                    |  2 +-
 .../normalization/normalization-docs.factor   |  4 +-
 .../images/normalization/normalization.factor |  6 +--
 basis/lists/lazy/lazy-docs.factor             |  2 +-
 basis/math/bitwise/bitwise-docs.factor        | 30 +++++++--------
 basis/math/bitwise/bitwise.factor             | 38 ++++++++-----------
 .../combinatorics/combinatorics-docs.factor   |  8 ++--
 basis/math/combinatorics/combinatorics.factor |  8 ++--
 .../math/polynomials/polynomials-docs.factor  |  6 +--
 basis/math/polynomials/polynomials.factor     |  6 +--
 .../math/quaternions/quaternions-docs.factor  |  2 +-
 basis/math/quaternions/quaternions.factor     |  6 +--
 basis/math/statistics/statistics-docs.factor  |  2 -
 basis/opengl/shaders/shaders-docs.factor      |  2 +-
 basis/random/random-docs.factor               |  2 +-
 basis/random/random.factor                    |  2 +-
 basis/roman/roman-docs.factor                 | 10 ++---
 basis/roman/roman.factor                      | 17 +++++----
 basis/sequences/deep/deep-docs.factor         |  2 +-
 basis/ui/gadgets/worlds/worlds-docs.factor    |  2 +-
 basis/xml-rpc/xml-rpc-docs.factor             |  2 +-
 basis/xml-rpc/xml-rpc.factor                  |  2 +-
 basis/xml/traversal/traversal-docs.factor     |  2 +-
 basis/xml/traversal/traversal.factor          |  2 +-
 core/kernel/kernel-docs.factor                |  2 +-
 core/parser/parser-docs.factor                |  2 +-
 core/sequences/sequences-docs.factor          | 23 ++++++-----
 core/sequences/sequences.factor               |  6 +--
 extra/game/models/collada/collada-docs.factor |  4 +-
 extra/game/models/collada/collada.factor      |  2 +-
 extra/game/models/obj/obj-docs.factor         |  2 +-
 extra/gpu/shaders/shaders-docs.factor         |  2 +-
 extra/math/transforms/fft/fft-docs.factor     |  2 +-
 extra/math/transforms/fft/fft.factor          | 12 +++---
 extra/math/transforms/haar/haar-docs.factor   |  4 +-
 extra/math/transforms/haar/haar.factor        |  6 +--
 extra/memory/piles/piles-docs.factor          |  1 -
 extra/mongodb/driver/driver-docs.factor       |  5 ---
 extra/spider/spider-docs.factor               |  1 -
 45 files changed, 120 insertions(+), 139 deletions(-)

diff --git a/basis/calendar/calendar-docs.factor b/basis/calendar/calendar-docs.factor
index 616c4d2c2c..6ce8b1d5fd 100644
--- a/basis/calendar/calendar-docs.factor
+++ b/basis/calendar/calendar-docs.factor
@@ -309,7 +309,7 @@ HELP: time-
 } ;
 
 HELP: convert-timezone
-{ $values { "timestamp" timestamp } { "duration" duration } { "timestamp" timestamp } }
+{ $values { "timestamp" timestamp } { "duration" duration } { "timestamp'" timestamp } }
 { $description "Converts the " { $snippet "timestamp" } "'s " { $snippet "gmt-offset" } " to the GMT offset represented by the " { $snippet "duration" } "." }
 { $examples
     { $example "USING: accessors calendar prettyprint ;"
@@ -319,7 +319,7 @@ HELP: convert-timezone
 } ;
 
 HELP: >local-time
-{ $values { "timestamp" timestamp } { "timestamp" timestamp } }
+{ $values { "timestamp" timestamp } { "timestamp'" timestamp } }
 { $description "Converts the " { $snippet "timestamp" } " to the timezone of your computer." }
 { $examples
     { $example "USING: accessors calendar kernel prettyprint ;"
@@ -329,7 +329,7 @@ HELP: >local-time
 } ;
 
 HELP: >gmt
-{ $values { "timestamp" timestamp } { "timestamp" timestamp } }
+{ $values { "timestamp" timestamp } { "timestamp'" timestamp } }
 { $description "Converts the " { $snippet "timestamp" } " to the GMT timezone." }
 { $examples
     { $example "USING: accessors calendar kernel prettyprint ;"
diff --git a/basis/calendar/calendar.factor b/basis/calendar/calendar.factor
index 3940af4856..1a64ceb646 100644
--- a/basis/calendar/calendar.factor
+++ b/basis/calendar/calendar.factor
@@ -316,15 +316,15 @@ M: duration <=> [ duration>years ] compare ;
 
 GENERIC: time- ( time1 time2 -- time3 )
 
-: convert-timezone ( timestamp duration -- timestamp )
+: convert-timezone ( timestamp duration -- timestamp' )
     over gmt-offset>> over = [ drop ] [
         [ over gmt-offset>> time- time+ ] keep >>gmt-offset
     ] if ;
 
-: >local-time ( timestamp -- timestamp )
+: >local-time ( timestamp -- timestamp' )
     gmt-offset-duration convert-timezone ;
 
-: >gmt ( timestamp -- timestamp )
+: >gmt ( timestamp -- timestamp' )
     instant convert-timezone ;
 
 M: timestamp <=> ( ts1 ts2 -- n )
diff --git a/basis/compression/lzw/lzw-docs.factor b/basis/compression/lzw/lzw-docs.factor
index 28dc36902b..55c54bc9f7 100644
--- a/basis/compression/lzw/lzw-docs.factor
+++ b/basis/compression/lzw/lzw-docs.factor
@@ -20,7 +20,6 @@ HELP: tiff-lzw-uncompress
 
 HELP: lzw-read
 { $values
-    { "lzw" lzw }
     { "lzw" lzw } { "n" integer }
 }
 { $description "Read the next LZW code." } ;
@@ -48,7 +47,6 @@ HELP: code-space-full?
 HELP: reset-lzw-uncompress
 { $values
     { "lzw" lzw }
-    { "lzw" lzw }
 }
 { $description "Reset the LZW uncompressor state (either at initialization time or immediately after receiving a Clear Code). " } ;
 
diff --git a/basis/db/tuples/tuples-docs.factor b/basis/db/tuples/tuples-docs.factor
index 01d65484f3..2c5db1c90d 100644
--- a/basis/db/tuples/tuples-docs.factor
+++ b/basis/db/tuples/tuples-docs.factor
@@ -51,7 +51,7 @@ HELP: <insert-user-assigned-statement>
 HELP: <select-by-slots-statement>
 { $values
      { "tuple" tuple } { "class" class }
-     { "tuple" tuple } }
+     { "statement" tuple } }
 { $description "A database-specific hook for generating the SQL for a select statement." } ;
 
 HELP: <update-tuple-statement>
diff --git a/basis/db/tuples/tuples.factor b/basis/db/tuples/tuples.factor
index 388c9ba47e..d193b5921e 100644
--- a/basis/db/tuples/tuples.factor
+++ b/basis/db/tuples/tuples.factor
@@ -14,7 +14,7 @@ HOOK: <insert-db-assigned-statement> db-connection ( class -- object )
 HOOK: <insert-user-assigned-statement> db-connection ( class -- object )
 HOOK: <update-tuple-statement> db-connection ( class -- object )
 HOOK: <delete-tuples-statement> db-connection ( tuple class -- object )
-HOOK: <select-by-slots-statement> db-connection ( tuple class -- tuple )
+HOOK: <select-by-slots-statement> db-connection ( tuple class -- statement )
 HOOK: <count-statement> db-connection ( query -- statement )
 HOOK: query>statement db-connection ( query -- statement )
 HOOK: insert-tuple-set-key db-connection ( tuple statement -- )
diff --git a/basis/dlists/dlists-docs.factor b/basis/dlists/dlists-docs.factor
index 716c20d6f6..5036441f60 100644
--- a/basis/dlists/dlists-docs.factor
+++ b/basis/dlists/dlists-docs.factor
@@ -48,7 +48,7 @@ HELP: dlist-find
 } ;
 
 HELP: dlist-filter
-{ $values { "dlist" { $link dlist } } { "quot" quotation } { "dlist" { $link dlist } } }
+{ $values { "dlist" { $link dlist } } { "quot" quotation } { "dlist'" { $link dlist } } }
 { $description "Applies the quotation to each element of the " { $link dlist } " in turn, removing the corresponding nodes if the quotation returns " { $link f } "." }
 { $side-effects { "dlist" } } ;
 
diff --git a/basis/dlists/dlists.factor b/basis/dlists/dlists.factor
index 668ba23054..317ed81e3e 100644
--- a/basis/dlists/dlists.factor
+++ b/basis/dlists/dlists.factor
@@ -157,7 +157,7 @@ M: dlist clear-deque ( dlist -- )
 
 : 1dlist ( obj -- dlist ) <dlist> [ push-front ] keep ;
 
-: dlist-filter ( dlist quot -- dlist )
+: dlist-filter ( dlist quot -- dlist' )
     over [ '[ dup obj>> @ [ drop ] [ _ delete-node ] if ] dlist-each-node ] keep ; inline
 
 M: dlist clone
diff --git a/basis/images/normalization/normalization-docs.factor b/basis/images/normalization/normalization-docs.factor
index 8ed4b659ed..39e2fee769 100644
--- a/basis/images/normalization/normalization-docs.factor
+++ b/basis/images/normalization/normalization-docs.factor
@@ -6,14 +6,14 @@ IN: images.normalization
 HELP: normalize-image
 { $values
     { "image" image }
-    { "image" image }
+    { "image'" image }
 }
 { $description "Converts the image to RGBA with ubyte-components. If the image is upside-down, it will be flipped right side up such that the 1st byte in the bitmap slot's byte array corresponds to the first color component of the pixel in the upper-left corner of the image." } ;
 
 HELP: reorder-components
 { $values
     { "image" image } { "component-order" component-order }
-    { "image" image }
+    { "image'" image }
 }
 { $description "Convert the bitmap in " { $snippet "image" } " such that the pixel sample layout corresponds to " { $snippet "component-order" } ". If the destination layout cannot find a corresponding value from the source layout, the value " { $snippet "255" } " will be substituted for that byte." }
 { $warning "The image's " { $snippet "component-type" } " will be changed to " { $snippet "ubyte-components" } " if it is not already in that format."
diff --git a/basis/images/normalization/normalization.factor b/basis/images/normalization/normalization.factor
index 2bd7e6883f..6eaca01e15 100644
--- a/basis/images/normalization/normalization.factor
+++ b/basis/images/normalization/normalization.factor
@@ -55,7 +55,7 @@ M: ushort-components normalize-component-type*
 M: ubyte-components normalize-component-type*
     drop ;
 
-: normalize-scan-line-order ( image -- image )
+: normalize-scan-line-order ( image -- image' )
     dup upside-down?>> [
         dup dim>> first 4 * '[
             _ <groups> reverse concat
@@ -71,14 +71,14 @@ M: ubyte-components normalize-component-type*
 
 PRIVATE>
 
-: reorder-components ( image component-order -- image )
+: reorder-components ( image component-order -- image' )
     [
         dup component-type>> '[ _ normalize-component-type* ] change-bitmap
         dup component-order>>
     ] dip
     validate-request [ (reorder-components) ] keep >>component-order ;
 
-: normalize-image ( image -- image )
+: normalize-image ( image -- image' )
     [ >byte-array ] change-bitmap
     RGBA reorder-components
     normalize-scan-line-order ;
diff --git a/basis/lists/lazy/lazy-docs.factor b/basis/lists/lazy/lazy-docs.factor
index 3b23e1186e..201764bd95 100644
--- a/basis/lists/lazy/lazy-docs.factor
+++ b/basis/lists/lazy/lazy-docs.factor
@@ -144,7 +144,7 @@ HELP: lcomp
 { $description "Get the cartesian product of the lists in " { $snippet "list" } " and call " { $snippet "quot" } " call with each element from the cartesian product on the stack, the result of which is returned in the final " { $snippet "list" } "." } ;
 
 HELP: lcomp*
-{ $values { "list" "a list of lists" } { "guards" "a sequence of quotations with stack effect ( seq -- bool )" } { "quot" { $quotation "( seq -- X )" } } { "list" "the resulting list" } { "result" "a list" } }
+{ $values { "list" "a list of lists" } { "guards" "a sequence of quotations with stack effect ( seq -- bool )" } { "quot" { $quotation "( seq -- X )" } } { "result" "a list" } }
 { $description "Get the cartesian product of the lists in " { $snippet "list" } ", filter it by applying each guard quotation to it and call " { $snippet "quot" } " call with each element from the remaining cartesian product items on the stack, the result of which is returned in the final " { $snippet "list" } "." }
 { $examples
   { $code "{ 1 2 3 } >list { 4 5 6 } >list 2list { [ first odd? ] } [ first2 + ] lcomp*" }
diff --git a/basis/math/bitwise/bitwise-docs.factor b/basis/math/bitwise/bitwise-docs.factor
index 5dce9646f4..bbc72d99e4 100644
--- a/basis/math/bitwise/bitwise-docs.factor
+++ b/basis/math/bitwise/bitwise-docs.factor
@@ -88,10 +88,10 @@ HELP: bit-count
 
 HELP: bitroll-32
 { $values
-     { "n" integer } { "s" integer }
-     { "n'" integer }
+     { "m" integer } { "s" integer }
+     { "n" integer }
 }     
-{ $description "Rolls the number " { $snippet "n" } " by " { $snippet "s" } " bits to the left, wrapping around after 32 bits." }
+{ $description "Rolls the number " { $snippet "m" } " by " { $snippet "s" } " bits to the left, wrapping around after 32 bits." }
 { $examples 
     { $example "USING: math.bitwise prettyprint ;"
                "HEX: 1 10 bitroll-32 .h"
@@ -105,10 +105,10 @@ HELP: bitroll-32
 
 HELP: bitroll-64
 { $values
-     { "n" integer } { "s" "a shift integer" }
-     { "n'" integer }
+     { "m" integer } { "s" "a shift integer" }
+     { "n" integer }
 }
-{ $description "Rolls the number " { $snippet "n" } " by " { $snippet "s" } " bits to the left, wrapping around after 64 bits." }
+{ $description "Rolls the number " { $snippet "m" } " by " { $snippet "s" } " bits to the left, wrapping around after 64 bits." }
 { $examples 
     { $example "USING: math.bitwise prettyprint ;"
                "HEX: 1 10 bitroll-64 .h"
@@ -226,10 +226,10 @@ HELP: odd-parity?
 
 HELP: on-bits
 { $values
-     { "n" integer }
      { "m" integer }
+     { "n" integer }
 }
-{ $description "Returns an integer with " { $snippet "n" } " bits set." }
+{ $description "Returns an integer with " { $snippet "m" } " bits set." }
 { $examples
     { $example "USING: math.bitwise kernel prettyprint ;"
         "6 on-bits .h"
@@ -274,7 +274,7 @@ HELP: set-bit
 
 HELP: shift-mod
 { $values
-     { "n" integer } { "s" integer } { "w" integer }
+     { "m" integer } { "s" integer } { "w" integer }
      { "n" integer }
 }
 { $description "Calls " { $link shift } " on " { $snippet "n" } " and " { $snippet "s" } ", wrapping the result to " { $snippet "w" } " bits." } ;
@@ -307,8 +307,8 @@ HELP: unmask?
 
 HELP: w*
 { $values
-     { "int" integer } { "int" integer }
-     { "int" integer }
+     { "x" integer } { "y" integer }
+     { "z" integer }
 }
 { $description "Multiplies two integers and wraps the result to 32 bits." }
 { $examples
@@ -320,8 +320,8 @@ HELP: w*
 
 HELP: w+
 { $values
-     { "int" integer } { "int" integer }
-     { "int" integer }
+     { "x" integer } { "y" integer }
+     { "z" integer }
 }
 { $description "Adds two integers and wraps the result to 32 bits." }
 { $examples
@@ -333,8 +333,8 @@ HELP: w+
 
 HELP: w-
 { $values
-     { "int" integer } { "int" integer }
-     { "int" integer }
+     { "x" integer } { "y" integer }
+     { "z" integer }
 }
 { $description "Subtracts two integers and wraps the result to 32 bits." }
 { $examples
diff --git a/basis/math/bitwise/bitwise.factor b/basis/math/bitwise/bitwise.factor
index 6b301fa97b..e508b49a19 100644
--- a/basis/math/bitwise/bitwise.factor
+++ b/basis/math/bitwise/bitwise.factor
@@ -17,29 +17,32 @@ IN: math.bitwise
 : wrap ( m n -- m' ) 1 - bitand ; inline
 : bits ( m n -- m' ) 2^ wrap ; inline
 : mask-bit ( m n -- m' ) 2^ mask ; inline
-: on-bits ( n -- m ) 2^ 1 - ; inline
+: on-bits ( m -- n ) 2^ 1 - ; inline
 : toggle-bit ( m n -- m' ) 2^ bitxor ; inline
-
-: shift-mod ( n s w -- n )
-    [ shift ] dip 2^ wrap ; inline
+: >signed ( x n -- y ) 2dup neg 1 + shift 1 = [ 2^ - ] [ drop ] if ;
+: >odd ( m -- n ) 0 set-bit ; foldable
+: >even ( m -- n ) 0 clear-bit ; foldable
+: next-even ( m -- n ) >even 2 + ; foldable
+: next-odd ( m -- n ) dup even? [ 1 + ] [ 2 + ] if ; foldable
+: shift-mod ( m s w -- n ) [ shift ] dip 2^ wrap ; inline
 
 : bitroll ( x s w -- y )
     [ wrap ] keep
     [ shift-mod ] [ [ - ] keep shift-mod ] 3bi bitor ; inline
 
-: bitroll-32 ( n s -- n' ) 32 bitroll ; inline
+: bitroll-32 ( m s -- n ) 32 bitroll ; inline
 
-: bitroll-64 ( n s -- n' ) 64 bitroll ; inline
+: bitroll-64 ( m s -- n ) 64 bitroll ; inline
 
 ! 32-bit arithmetic
-: w+ ( int int -- int ) + 32 bits ; inline
-: w- ( int int -- int ) - 32 bits ; inline
-: w* ( int int -- int ) * 32 bits ; inline
+: w+ ( x y -- z ) + 32 bits ; inline
+: w- ( x y -- z ) - 32 bits ; inline
+: w* ( x y -- z ) * 32 bits ; inline
 
 ! 64-bit arithmetic
-: W+ ( int int -- int ) + 64 bits ; inline
-: W- ( int int -- int ) - 64 bits ; inline
-: W* ( int int -- int ) * 64 bits ; inline
+: W+ ( x y -- z ) + 64 bits ; inline
+: W- ( x y -- z ) - 64 bits ; inline
+: W* ( x y -- z ) * 64 bits ; inline
 
 ! flags
 MACRO: flags ( values -- )
@@ -117,17 +120,6 @@ M: object bit-count
     [ >c-ptr ] [ byte-length ] bi <direct-uchar-array>
     byte-array-bit-count ;
 
-: >signed ( x n -- y )
-    2dup neg 1 + shift 1 = [ 2^ - ] [ drop ] if ;
-
-: >odd ( n -- int ) 0 set-bit ; foldable
-
-: >even ( n -- int ) 0 clear-bit ; foldable
-
-: next-even ( m -- n ) >even 2 + ; foldable
-
-: next-odd ( m -- n ) dup even? [ 1 + ] [ 2 + ] if ; foldable
-
 : even-parity? ( obj -- ? ) bit-count even? ;
 
 : odd-parity? ( obj -- ? ) bit-count odd? ;
diff --git a/basis/math/combinatorics/combinatorics-docs.factor b/basis/math/combinatorics/combinatorics-docs.factor
index ec3cd6ee76..0a2a0d4011 100644
--- a/basis/math/combinatorics/combinatorics-docs.factor
+++ b/basis/math/combinatorics/combinatorics-docs.factor
@@ -26,7 +26,7 @@ HELP: nCk
 } ;
 
 HELP: permutation
-{ $values { "n" "a non-negative integer" } { "seq" sequence } { "seq" sequence } }
+{ $values { "n" "a non-negative integer" } { "seq" sequence } { "seq'" sequence } }
 { $description "Outputs the " { $snippet "nth" } " lexicographical permutation of " { $snippet "seq" } "." }
 { $notes "Permutations are 0-based and a bounds error will be thrown if " { $snippet "n" } " is larger than " { $snippet "seq length factorial 1 -" } "." }
 { $examples
@@ -37,7 +37,7 @@ HELP: permutation
 } ;
 
 HELP: all-permutations
-{ $values { "seq" sequence } { "seq" sequence } }
+{ $values { "seq" sequence } { "seq'" sequence } }
 { $description "Outputs a sequence containing all permutations of " { $snippet "seq" } " in lexicographical order." }
 { $examples
     { $example "USING: math.combinatorics prettyprint ;"
@@ -60,7 +60,7 @@ HELP: inverse-permutation
 } ;
 
 HELP: combination
-{ $values { "m" "a non-negative integer" } { "seq" sequence } { "k" "a non-negative integer" } { "seq" sequence } }
+{ $values { "m" "a non-negative integer" } { "seq" sequence } { "k" "a non-negative integer" } { "seq'" sequence } }
 { $description "Outputs the " { $snippet "mth" } " lexicographical combination of " { $snippet "seq" } " choosing " { $snippet "k" } " elements." }
 { $notes "Combinations are 0-based and a bounds error will be thrown if " { $snippet "m" } " is larger than " { $snippet "seq length k nCk" } "." }
 { $examples
@@ -71,7 +71,7 @@ HELP: combination
 } ;
 
 HELP: all-combinations
-{ $values { "seq" sequence } { "k" "a non-negative integer" } { "seq" sequence } }
+{ $values { "seq" sequence } { "k" "a non-negative integer" } { "seq'" sequence } }
 { $description "Outputs a sequence containing all combinations of " { $snippet "seq" } " choosing " { $snippet "k" } " elements, in lexicographical order." }
 { $examples
     { $example "USING: math.combinatorics prettyprint ;"
diff --git a/basis/math/combinatorics/combinatorics.factor b/basis/math/combinatorics/combinatorics.factor
index 7c68aede09..5a9f627015 100644
--- a/basis/math/combinatorics/combinatorics.factor
+++ b/basis/math/combinatorics/combinatorics.factor
@@ -42,10 +42,10 @@ PRIVATE>
 
 PRIVATE>
 
-: permutation ( n seq -- seq )
+: permutation ( n seq -- seq' )
     [ permutation-indices ] keep nths ;
 
-: all-permutations ( seq -- seq )
+: all-permutations ( seq -- seq' )
     [ length factorial iota ] keep
     '[ _ permutation ] map ;
 
@@ -118,10 +118,10 @@ PRIVATE>
 : map>assoc-combinations ( seq k quot exemplar -- )
     [ combinations-quot ] dip map>assoc ; inline
 
-: combination ( m seq k -- seq )
+: combination ( m seq k -- seq' )
     <combo> apply-combination ;
 
-: all-combinations ( seq k -- seq )
+: all-combinations ( seq k -- seq' )
     [ ] combinations-quot map ;
 
 : reduce-combinations ( seq k identity quot -- result )
diff --git a/basis/math/polynomials/polynomials-docs.factor b/basis/math/polynomials/polynomials-docs.factor
index 9c16bf8a7e..3b8885cc88 100644
--- a/basis/math/polynomials/polynomials-docs.factor
+++ b/basis/math/polynomials/polynomials-docs.factor
@@ -36,12 +36,12 @@ HELP: p=
 { $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 } { 0 1 0 } p= ." "t" } } ;
 
 HELP: ptrim
-{ $values { "p" "a polynomial" } { "p" "a polynomial" } }
+{ $values { "p" "a polynomial" } { "q" "a polynomial" } }
 { $description "Trims excess zeros from a polynomial." }
 { $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 0 0 } ptrim ." "{ 0 1 }" } } ;
 
 HELP: 2ptrim
-{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "p" "a polynomial" } { "q" "a polynomial" } }
+{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "p'" "a polynomial" } { "q'" "a polynomial" } }
 { $description "Trims excess zeros from two polynomials." }
 { $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 0 1 0 0 } { 1 0 0 } 2ptrim [ . ] bi@" "{ 0 1 }\n{ 1 }" } } ;
 
@@ -61,7 +61,7 @@ HELP: n*p
 { $examples { $example "USING: math.polynomials prettyprint ;" "4 { 3 0 1 } n*p ." "{ 12 0 4 }" } } ;
 
 HELP: pextend-conv
-{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "p" "a polynomial" } { "q" "a polynomial" } }
+{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "p'" "a polynomial" } { "q'" "a polynomial" } }
 { $description "Convulution, extending to " { $snippet "p_m + q_n - 1" } "." }
 { $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } pextend-conv [ . ] bi@" "V{ 1 0 1 0 }\nV{ 0 1 0 0 }" } } ;
 
diff --git a/basis/math/polynomials/polynomials.factor b/basis/math/polynomials/polynomials.factor
index b994410283..31152016ea 100644
--- a/basis/math/polynomials/polynomials.factor
+++ b/basis/math/polynomials/polynomials.factor
@@ -20,15 +20,15 @@ PRIVATE>
 
 : p= ( p q -- ? ) pextend = ;
 
-: ptrim ( p -- p )
+: ptrim ( p -- q )
     dup length 1 = [ [ zero? ] trim-tail ] unless ;
 
-: 2ptrim ( p q -- p q ) [ ptrim ] bi@ ;
+: 2ptrim ( p q -- p' q' ) [ ptrim ] bi@ ;
 : p+ ( p q -- r ) pextend v+ ;
 : p- ( p q -- r ) pextend v- ;
 : n*p ( n p -- n*p ) n*v ;
 
-: pextend-conv ( p q -- p q )
+: pextend-conv ( p q -- p' q' )
     2dup [ length ] bi@ + 1 - 2pad-tail [ >vector ] bi@ ;
 
 : p* ( p q -- r )
diff --git a/basis/math/quaternions/quaternions-docs.factor b/basis/math/quaternions/quaternions-docs.factor
index 1a381c6287..d3bead7dea 100644
--- a/basis/math/quaternions/quaternions-docs.factor
+++ b/basis/math/quaternions/quaternions-docs.factor
@@ -30,7 +30,7 @@ HELP: q/
 { $examples { $example "USING: math.quaternions prettyprint ;" "{ 0 0 0 1 } { 0 0 1 0 } q/ ." "{ 0 1 0 0 }" } } ;
 
 HELP: q*n
-{ $values { "q" "a quaternion" } { "n" real } { "q" "a quaternion" } }
+{ $values { "q" "a quaternion" } { "n" real } { "r" "a quaternion" } }
 { $description "Multiplies each element of " { $snippet "q" } " by real value " { $snippet "n" } "." }
 { $notes "To multiply a quaternion with a complex value, use " { $link c>q } " " { $link q* } "." } ;
 
diff --git a/basis/math/quaternions/quaternions.factor b/basis/math/quaternions/quaternions.factor
index e659cf5f61..4173507e6c 100644
--- a/basis/math/quaternions/quaternions.factor
+++ b/basis/math/quaternions/quaternions.factor
@@ -1,4 +1,4 @@
-! Copyright (C) 2005, 2007 Slava Pestov.
+! Copyright (C) 2005, 2010 Joe Groff, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays combinators kernel locals math math.functions
 math.libm math.order math.vectors sequences ;
@@ -35,10 +35,10 @@ M: object qconjugate ( u -- u' )
 : q/ ( u v -- u/v )
     qrecip q* ; inline
 
-: n*q ( q n -- q )
+: n*q ( q n -- r )
     v*n ; inline
 
-: q*n ( q n -- q )
+: q*n ( q n -- r )
     v*n ; inline
 
 : n>q ( n -- q )
diff --git a/basis/math/statistics/statistics-docs.factor b/basis/math/statistics/statistics-docs.factor
index 6fa7d79f77..f7d108dddb 100644
--- a/basis/math/statistics/statistics-docs.factor
+++ b/basis/math/statistics/statistics-docs.factor
@@ -87,7 +87,6 @@ HELP: histogram
 HELP: histogram!
 { $values
     { "hashtable" hashtable } { "seq" sequence }
-    { "hashtable" hashtable }
 }
 { $examples 
     { $example "! Count the number of times the elements of two sequences appear."
@@ -128,7 +127,6 @@ HELP: sequence>assoc
 HELP: sequence>assoc!
 { $values
     { "assoc" assoc } { "seq" sequence } { "quot" quotation }
-    { "assoc" assoc }
 }
 { $examples 
     { $example "! Iterate over a sequence and add the counts to an existing assoc"
diff --git a/basis/opengl/shaders/shaders-docs.factor b/basis/opengl/shaders/shaders-docs.factor
index 1a10071ddf..c3e4d045ef 100644
--- a/basis/opengl/shaders/shaders-docs.factor
+++ b/basis/opengl/shaders/shaders-docs.factor
@@ -52,7 +52,7 @@ HELP: delete-gl-shader
 { $description "Deletes the shader object, invalidating it and releasing any resources allocated for it by the OpenGL implementation." } ;
 
 HELP: gl-shader-info-log
-{ $values { "shader" "A " { $link gl-shader } " object" } { "shader" "a new " { $link gl-shader } } { "log" string } }
+{ $values { "shader" "A " { $link gl-shader } " object" } { "log" string } }
 { $description "Retrieves the info log for " { $snippet "shader" } ", including any errors or warnings generated in compiling the shader object." } ;
 
 HELP: gl-program
diff --git a/basis/random/random-docs.factor b/basis/random/random-docs.factor
index 175c34ad9d..20d5dc0214 100644
--- a/basis/random/random-docs.factor
+++ b/basis/random/random-docs.factor
@@ -75,7 +75,7 @@ HELP: with-system-random
 HELP: randomize
 { $values
      { "seq" sequence }
-     { "seq" sequence }
+     { "randomized" sequence }
 }
 { $description "Randomizes a sequence in-place with the Fisher-Yates algorithm and returns the sequence." } ;
 
diff --git a/basis/random/random.factor b/basis/random/random.factor
index eeaa1f8f2c..ba5d9c7ca3 100644
--- a/basis/random/random.factor
+++ b/basis/random/random.factor
@@ -67,7 +67,7 @@ M: sequence random
     [ [ random ] [ 1 - ] bi [ pick exchange ] keep ]
     while drop ;
 
-: randomize ( seq -- seq ) 
+: randomize ( seq -- randomized )
     dup length randomize-n-last ;
 
 ERROR: too-many-samples seq n ;
diff --git a/basis/roman/roman-docs.factor b/basis/roman/roman-docs.factor
index c81ed0ae42..c9c3db71b5 100644
--- a/basis/roman/roman-docs.factor
+++ b/basis/roman/roman-docs.factor
@@ -39,7 +39,7 @@ HELP: roman>
 { >roman >ROMAN roman> } related-words
 
 HELP: roman+
-{ $values { "x" string } { "x" string } { "x" string } }
+{ $values { "x" string } { "y" string } { "z" string } }
 { $description "Adds two Roman numerals." }
 { $examples 
     { $example "USING: io roman ;"
@@ -49,7 +49,7 @@ HELP: roman+
 } ;
 
 HELP: roman-
-{ $values { "x" string } { "x" string } { "x" string } }
+{ $values { "x" string } { "y" string } { "z" string } }
 { $description "Subtracts two Roman numerals." }
 { $examples 
     { $example "USING: io roman ;"
@@ -61,7 +61,7 @@ HELP: roman-
 { roman+ roman- } related-words
 
 HELP: roman*
-{ $values { "x" string } { "x" string } { "x" string } }
+{ $values { "x" string } { "y" string } { "z" string } }
 { $description "Multiplies two Roman numerals." }
 { $examples 
     { $example "USING: io roman ;"
@@ -71,7 +71,7 @@ HELP: roman*
 } ;
 
 HELP: roman/i
-{ $values { "x" string } { "x" string } { "x" string } }
+{ $values { "x" string } { "y" string } { "z" string } }
 { $description "Computes the integer division of two Roman numerals." }
 { $examples 
     { $example "USING: io roman ;"
@@ -81,7 +81,7 @@ HELP: roman/i
 } ;
 
 HELP: roman/mod
-{ $values { "x" string } { "x" string } { "x" string } { "x" string } }
+{ $values { "x" string } { "y" string } { "z" string } { "w" string } }
 { $description "Computes the quotient and remainder of two Roman numerals." }
 { $examples 
     { $example "USING: kernel io roman ;"
diff --git a/basis/roman/roman.factor b/basis/roman/roman.factor
index a783e7973c..588166829a 100644
--- a/basis/roman/roman.factor
+++ b/basis/roman/roman.factor
@@ -2,8 +2,9 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs effects fry generalizations
 grouping kernel lexer macros math math.order math.vectors
-namespaces parser quotations sequences sequences.private
-splitting.monotonic stack-checker strings unicode.case words ;
+namespaces parser effects.parser quotations sequences
+sequences.private splitting.monotonic stack-checker strings
+unicode.case words ;
 IN: roman
 
 <PRIVATE
@@ -58,14 +59,14 @@ PRIVATE>
 SYNTAX: ROMAN-OP:
     scan-word [ name>> "roman" prepend create-in ] keep
     1quotation '[ _ binary-roman-op ]
-    dup infer define-declared ;
+    complete-effect define-declared ;
 
 >>
 
-ROMAN-OP: +
-ROMAN-OP: -
-ROMAN-OP: *
-ROMAN-OP: /i
-ROMAN-OP: /mod
+ROMAN-OP: + ( x y -- z )
+ROMAN-OP: - ( x y -- z )
+ROMAN-OP: * ( x y -- z )
+ROMAN-OP: /i ( x y -- z )
+ROMAN-OP: /mod ( x y -- z w )
 
 SYNTAX: ROMAN: scan roman> suffix! ;
diff --git a/basis/sequences/deep/deep-docs.factor b/basis/sequences/deep/deep-docs.factor
index e8b9ddea6d..6f479e48b6 100644
--- a/basis/sequences/deep/deep-docs.factor
+++ b/basis/sequences/deep/deep-docs.factor
@@ -31,7 +31,7 @@ HELP: flatten
 { $description "Creates a sequence of all of the leaf nodes (non-sequence nodes, but including strings and numbers) in the object." } ;
 
 HELP: deep-map!
-{ $values { "obj" object } { "quot" { $quotation "( elt -- newelt )" } } { "obj" object } }
+{ $values { "obj" object } { "quot" { $quotation "( elt -- newelt )" } } }
 { $description "Modifies each sub-node of an object in place, in preorder, and returns that object." }
 { $see-also map! } ;
 
diff --git a/basis/ui/gadgets/worlds/worlds-docs.factor b/basis/ui/gadgets/worlds/worlds-docs.factor
index 83d042db43..0d7e40a789 100644
--- a/basis/ui/gadgets/worlds/worlds-docs.factor
+++ b/basis/ui/gadgets/worlds/worlds-docs.factor
@@ -33,7 +33,7 @@ HELP: set-gl-context
 { $description "Selects an OpenGL context to be the implicit destination for subsequent GL rendering calls. This word is called automatically by the UI before drawing a " { $link world } "." } ;
 
 HELP: window-resource
-{ $values { "resource" disposable } { "resource" disposable } }
+{ $values { "resource" disposable } }
 { $description "Marks " { $snippet "resource" } " to be destroyed with " { $link dispose } " when the window with the currently active OpenGL context (set by " { $link set-gl-context } ") is closed. " { $snippet "resource" } " is left unmodified at the top of the stack." } ;
 
 HELP: flush-gl-context
diff --git a/basis/xml-rpc/xml-rpc-docs.factor b/basis/xml-rpc/xml-rpc-docs.factor
index 113fc00407..aeb29c5d07 100644
--- a/basis/xml-rpc/xml-rpc-docs.factor
+++ b/basis/xml-rpc/xml-rpc-docs.factor
@@ -49,7 +49,7 @@ HELP: rpc-fault
 
 HELP: post-rpc
 { $values { "rpc" "an XML-RPC input tuple" } { "url" "a URL" }
-    { "rpc" "an XML-RPC output tuple" } }
+    { "rpc'" "an XML-RPC output tuple" } }
 { $description "posts an XML-RPC document to the specified URL, receives the response and parses it as XML-RPC, returning the tuple" } ;
 
 ARTICLE: { "xml-rpc" "intro" } "XML-RPC"
diff --git a/basis/xml-rpc/xml-rpc.factor b/basis/xml-rpc/xml-rpc.factor
index 370c778787..4c6570c4de 100644
--- a/basis/xml-rpc/xml-rpc.factor
+++ b/basis/xml-rpc/xml-rpc.factor
@@ -186,7 +186,7 @@ TAG: array xml>item
 
 PRIVATE>
 
-: post-rpc ( rpc url -- rpc )
+: post-rpc ( rpc url -- rpc' )
     ! This needs to do something in the event of an error
     rpc-post-request http-request nip string>xml receive-rpc ;
 
diff --git a/basis/xml/traversal/traversal-docs.factor b/basis/xml/traversal/traversal-docs.factor
index bb7ce7ce31..d8032d99fc 100644
--- a/basis/xml/traversal/traversal-docs.factor
+++ b/basis/xml/traversal/traversal-docs.factor
@@ -58,7 +58,7 @@ HELP: children-tags
 { $see-also first-child-tag } ;
 
 HELP: first-child-tag
-{ $values { "tag" "an XML tag or document" } { "tag" tag } }
+{ $values { "tag" "an XML tag or document" } { "child" tag } }
 { $description "Returns the first child of the given tag that is a tag." }
 { $see-also children-tags } ;
 
diff --git a/basis/xml/traversal/traversal.factor b/basis/xml/traversal/traversal.factor
index b337ea1472..46a5896814 100644
--- a/basis/xml/traversal/traversal.factor
+++ b/basis/xml/traversal/traversal.factor
@@ -18,7 +18,7 @@ IN: xml.traversal
 : children-tags ( tag -- sequence )
     children>> [ tag? ] filter ;
 
-: first-child-tag ( tag -- tag )
+: first-child-tag ( tag -- child )
     children>> [ tag? ] find nip ;
 
 : tag-named? ( name elem -- ? )
diff --git a/core/kernel/kernel-docs.factor b/core/kernel/kernel-docs.factor
index c92ef7d599..8b9650fc31 100644
--- a/core/kernel/kernel-docs.factor
+++ b/core/kernel/kernel-docs.factor
@@ -708,7 +708,7 @@ HELP: 3curry
 { $notes "This operation is efficient and does not copy the quotation." } ;
 
 HELP: with
-{ $values { "param" object } { "obj" object } { "quot" { $quotation "( param elt -- ... )" } } { "obj" object } { "curry" curry } }
+{ $values { "param" object } { "obj" object } { "quot" { $quotation "( param elt -- ... )" } } { "curry" curry } }
 { $description "Partial application on the left. The following two lines are equivalent:"
     { $code "swap [ swap A ] curry B" }
     { $code "[ A ] with B" }
diff --git a/core/parser/parser-docs.factor b/core/parser/parser-docs.factor
index 3062f55a42..b024d1d968 100644
--- a/core/parser/parser-docs.factor
+++ b/core/parser/parser-docs.factor
@@ -177,7 +177,7 @@ HELP: parse-lines
 { $errors "Throws a " { $link lexer-error } " if the input is malformed." } ;
 
 HELP: parse-base
-{ $values { "parsed" integer } { "base" "an integer between 2 and 36" } { "parsed" integer } }
+{ $values { "parsed" integer } { "base" "an integer between 2 and 36" } }
 { $description "Reads an integer in a specific numerical base from the parser input." }
 $parsing-note ;
 
diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor
index 02dadb323c..38eadc745d 100644
--- a/core/sequences/sequences-docs.factor
+++ b/core/sequences/sequences-docs.factor
@@ -296,7 +296,7 @@ $nl
 } ;
 
 HELP: accumulate!
-{ $values { "seq" sequence } { "identity" object } { "quot" { $quotation "( prev elt -- next )" } } { "final" "the final result" } { "seq" sequence } }
+{ $values { "seq" sequence } { "identity" object } { "quot" { $quotation "( prev elt -- next )" } } { "final" "the final result" } }
 { $description "Combines successive elements of the sequence using a binary operation, and outputs the original sequence of intermediate results, together with the final result."
 $nl
 "The first element of the new sequence is " { $snippet "identity" } ". Then, on the first iteration, the two inputs to the quotation are " { $snippet "identity" } ", and the first element of the old sequence. On successive iterations, the first input is the result of the previous iteration, and the second input is the corresponding element of the old sequence."
@@ -344,7 +344,7 @@ HELP: change-nth
 { $side-effects "seq" } ;
 
 HELP: map!
-{ $values { "seq" "a mutable sequence" } { "quot" { $quotation "( old -- new )" } } { "seq" "a mutable sequence" } }
+{ $values { "seq" "a mutable sequence" } { "quot" { $quotation "( old -- new )" } } }
 { $description "Applies the quotation to each element yielding a new element, storing the new elements back in the original sequence. Returns the original sequence." }
 { $errors "Throws an error if the sequence is immutable, or the sequence cannot hold elements of the type output by " { $snippet "quot" } "." }
 { $side-effects "seq" } ;
@@ -442,7 +442,7 @@ HELP: filter-as
 { $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!
-{ $values { "seq" "a resizable mutable sequence" } { "quot" { $quotation "( elt -- ? )" } } { "seq" "a resizable mutable sequence" } }
+{ $values { "seq" "a resizable mutable sequence" } { "quot" { $quotation "( elt -- ? )" } } }
 { $description "Applies the quotation to each element in turn, and removes elements for which the quotation outputs a false value." }
 { $side-effects "seq" } ;
 
@@ -503,19 +503,19 @@ HELP: move
 { $side-effects "seq" } ;
 
 HELP: remove!
-{ $values { "elt" object } { "seq" "a resizable mutable sequence" } { "elt" object } }
+{ $values { "elt" object } { "seq" "a resizable mutable sequence" } }
 { $description "Removes all elements equal to " { $snippet "elt" } " from " { $snippet "seq" } " and returns " { $snippet "seq" } "." }
 { $notes "This word uses equality comparison (" { $link = } ")." }
 { $side-effects "seq" } ;
 
 HELP: remove-eq!
-{ $values { "elt" object } { "seq" "a resizable mutable sequence" } { "seq" "a resizable mutable sequence" } }
+{ $values { "elt" object } { "seq" "a resizable mutable sequence" } }
 { $description "Outputs a new sequence containing all elements of the input sequence except the given element." }
 { $notes "This word uses identity comparison (" { $link eq? } ")." }
 { $side-effects "seq" } ;
 
 HELP: remove-nth!
-{ $values { "n" "a non-negative integer" } { "seq" "a resizable mutable sequence" } { "seq" "a resizable mutable sequence" } }
+{ $values { "n" "a non-negative integer" } { "seq" "a resizable mutable sequence" } }
 { $description "Removes the " { $snippet "n" } "th element from the sequence, shifting all other elements down and reducing its length by one." }
 { $side-effects "seq" } ;
 
@@ -540,7 +540,7 @@ HELP: suffix
 } ;
 
 HELP: suffix!
-{ $values { "seq" sequence } { "elt" object } { "seq" sequence } }
+{ $values { "seq" sequence } { "elt" object } }
 { $description "Modifiers a sequence in-place by adding " { $snippet "elt" } " to the end of " { $snippet "seq" } ". Outputs " { $snippet "seq" } "." }
 { $errors "Throws an error if the type of " { $snippet "elt" } " is not permitted in sequences of the same class as " { $snippet "seq" } "." }
 { $examples
@@ -548,7 +548,7 @@ HELP: suffix!
 } ;
 
 HELP: append!
-{ $values { "seq1" sequence } { "seq2" sequence } { "seq1" sequence } }
+{ $values { "seq1" sequence } { "seq2" sequence } }
 { $description "Modifiers " { $snippet "seq1" } " in-place by adding the elements from " { $snippet "seq2" } " to the end and outputs " { $snippet "seq1" } "." }
 { $examples
     { $example "USING: prettyprint sequences ;" "V{ 1 2 3 } { 4 5 6 } append! ." "V{ 1 2 3 4 5 6 }" }
@@ -996,7 +996,7 @@ HELP: count
 HELP: selector
 { $values
      { "quot" "a predicate quotation" }
-     { "quot" quotation } { "accum" vector } }
+     { "selector" quotation } { "accum" vector } }
 { $description "Creates a new vector to accumulate the values which return true for a predicate.  Returns a new quotation which accepts an object to be tested and stored in the collector if the test yields true. The collector is left on the stack for convenience." }
 { $example "! Find all the even numbers:" "USING: prettyprint sequences math kernel ;"
            "10 iota [ even? ] selector [ each ] dip ."
@@ -1202,7 +1202,7 @@ HELP: 2map-reduce
 HELP: 2selector
 { $values
      { "quot" quotation }
-     { "quot" quotation } { "accum1" vector } { "accum2" vector } }
+     { "selector" quotation } { "accum1" vector } { "accum2" vector } }
 { $description "Creates two new vectors to accumultate values based on a predicate. The first vector accumulates values for which the predicate yields true; the second for false." } ;
 
 HELP: 2reverse-each
@@ -1323,8 +1323,7 @@ HELP: sequence-hashcode-step
 
 HELP: short
 { $values
-     { "seq" sequence } { "n" integer }
-     { "seq" sequence } { "n'" integer } }
+     { "seq" sequence } { "n" integer } { "n'" integer } }
 { $description "Returns the input sequence and its length or " { $snippet "n" } ", whichever is less." }
 { $examples { $example "USING: sequences kernel prettyprint ;"
     "\"abcd\" 3 short [ . ] bi@"
diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor
index 23ab4b5d84..2eafe2ceb8 100644
--- a/core/sequences/sequences.factor
+++ b/core/sequences/sequences.factor
@@ -486,10 +486,10 @@ PRIVATE>
 : push-if ( elt quot accum -- )
     [ keep ] dip rot [ push ] [ 2drop ] if ; inline
 
-: selector-for ( quot exemplar -- quot accum )
+: selector-for ( quot exemplar -- selector accum )
     [ length ] keep new-resizable [ [ push-if ] 2curry ] keep ; inline
 
-: selector ( quot -- quot accum )
+: selector ( quot -- selector accum )
     V{ } selector-for ; inline
 
 : filter-as ( seq quot exemplar -- subseq )
@@ -501,7 +501,7 @@ PRIVATE>
 : push-either ( elt quot accum1 accum2 -- )
     [ keep swap ] 2dip ? push ; inline
 
-: 2selector ( quot -- quot accum1 accum2 )
+: 2selector ( quot -- selector accum1 accum2 )
     V{ } clone V{ } clone [ [ push-either ] 3curry ] 2keep ; inline
 
 : partition ( seq quot -- trueseq falseseq )
diff --git a/extra/game/models/collada/collada-docs.factor b/extra/game/models/collada/collada-docs.factor
index 5be2e19790..b8dad530a4 100644
--- a/extra/game/models/collada/collada-docs.factor
+++ b/extra/game/models/collada/collada-docs.factor
@@ -33,7 +33,7 @@ HELP: y-up { $class-description "Right-handed 3D coordinate system where Y is up
 HELP: z-up { $class-description "Right-handed 3D coordinate system where Z is up." } ;
 
 HELP: >y-up-axis!
-{ $values { "seq" sequence } { "from-axis" rh-up } { "seq" sequence } }
+{ $values { "seq" sequence } { "from-axis" rh-up } }
 { $description "Destructively swizzles the first three elements of the input sequence to a right-handed 3D coordinate system where Y is up and returns the modified sequence." } ;
 
 HELP: source>seq
@@ -53,7 +53,7 @@ HELP: mesh>vertices
 { $description "Convert the mesh tag's vertices element to a pair for further lookup in " { $link collect-sources } ". " } ;
 
 HELP: collect-sources
-{ $values { "sources" hashtable } { "vertices" pair } { "inputs" tag sequence } { "sources" sequence } }
+{ $values { "sources" hashtable } { "vertices" pair } { "inputs" tag sequence } { "seq" sequence } }
 { $description "Look up the sources for these " { $emphasis "input" } " elements and return a sequence of " { $link source } " tuples." } ;
 
 HELP: group-indices
diff --git a/extra/game/models/collada/collada.factor b/extra/game/models/collada/collada.factor
index ef1c55049b..bb7c73c2c7 100644
--- a/extra/game/models/collada/collada.factor
+++ b/extra/game/models/collada/collada.factor
@@ -94,7 +94,7 @@ M: z-up >y-up-axis!
       ] x*
     ] bi 2array ;
 
-:: collect-sources ( sources vertices inputs -- sources )
+:: collect-sources ( sources vertices inputs -- seq )
     inputs
     [| input |
         input "source" x@ rest vertices first =
diff --git a/extra/game/models/obj/obj-docs.factor b/extra/game/models/obj/obj-docs.factor
index ceb61dbb17..a41ca13b8e 100644
--- a/extra/game/models/obj/obj-docs.factor
+++ b/extra/game/models/obj/obj-docs.factor
@@ -58,7 +58,7 @@ HELP: face>aos
 { $description "Convert a face line to a sequence of vertex attributes." } ;
 
 HELP: push*
-{ $values { "elt" "an object" } { "seq" sequence } { "seq" sequence } }
+{ $values { "elt" "an object" } { "seq" sequence } }
 { $description "Push the value onto the sequence, keeping the sequence on the stack." } ;
 
 HELP: push-current-model
diff --git a/extra/gpu/shaders/shaders-docs.factor b/extra/gpu/shaders/shaders-docs.factor
index 96a8561e9f..54822c2fbb 100644
--- a/extra/gpu/shaders/shaders-docs.factor
+++ b/extra/gpu/shaders/shaders-docs.factor
@@ -172,7 +172,7 @@ HELP: vertex-array
 HELP: vertex-array-buffers
 { $values
     { "vertex-array" vertex-array }
-    { "vertex-buffer" buffer }
+    { "buffers" sequence }
 }
 { $description "Returns a sequence containing all of the " { $link buffer } " objects that make up " { $snippet "vertex-array" } "." } ;
 
diff --git a/extra/math/transforms/fft/fft-docs.factor b/extra/math/transforms/fft/fft-docs.factor
index 430058b362..93d72f39a4 100644
--- a/extra/math/transforms/fft/fft-docs.factor
+++ b/extra/math/transforms/fft/fft-docs.factor
@@ -2,6 +2,6 @@ USING: help.markup help.syntax sequences ;
 IN: math.transforms.fft
 
 HELP: fft
-{ $values { "seq" sequence } { "seq" sequence } }
+{ $values { "seq" sequence } { "seq'" sequence } }
 { $description "Fast Fourier transform function." } ;
 
diff --git a/extra/math/transforms/fft/fft.factor b/extra/math/transforms/fft/fft.factor
index 0688c00468..440243a968 100644
--- a/extra/math/transforms/fft/fft.factor
+++ b/extra/math/transforms/fft/fft.factor
@@ -13,26 +13,26 @@ IN: math.transforms.fft
 : omega ( n -- n' )
     recip -2 pi i* * * exp ;
 
-: twiddle ( seq -- seq )
+: twiddle ( seq -- seq' )
     dup length [ omega ] [ n^v ] bi v* ;
 
 PRIVATE>
 
 DEFER: fft
 
-: two ( seq -- seq )
+: two ( seq -- seq' )
     fft 2 v/n dup append ;
 
 <PRIVATE
 
-: even ( seq -- seq ) 2 group 0 <column> ;
-: odd ( seq -- seq ) 2 group 1 <column> ;
+: even ( seq -- seq' ) 2 group 0 <column> ;
+: odd ( seq -- seq' ) 2 group 1 <column> ;
 
-: (fft) ( seq -- seq )
+: (fft) ( seq -- seq' )
     [ odd two twiddle ] [ even two ] bi v+ ;
 
 PRIVATE>
 
-: fft ( seq -- seq )
+: fft ( seq -- seq' )
     dup length 1 = [ (fft) ] unless ;
 
diff --git a/extra/math/transforms/haar/haar-docs.factor b/extra/math/transforms/haar/haar-docs.factor
index 218a63a480..a9a4fd111f 100644
--- a/extra/math/transforms/haar/haar-docs.factor
+++ b/extra/math/transforms/haar/haar-docs.factor
@@ -2,13 +2,13 @@ USING: help.markup help.syntax sequences ;
 IN: math.transforms.haar
 
 HELP: haar
-{ $values { "seq" sequence } { "seq" sequence } }
+{ $values { "seq" sequence } { "seq'" sequence } }
 { $description "Haar wavelet transform function." }
 { $notes "The sequence length should be a power of two." }
 { $examples { $example "USING: math.transforms.haar prettyprint ;" "{ 7 1 6 6 3 -5 4 2 } haar ." "{ 3 2 -1 -2 3 0 4 1 }" } } ;
 
 HELP: rev-haar
-{ $values { "seq" sequence } { "seq" sequence } }
+{ $values { "seq" sequence } { "seq'" sequence } }
 { $description "Reverse Haar wavelet transform function." }
 { $notes "The sequence length should be a power of two." }
 { $examples { $example "USING: math.transforms.haar prettyprint ;" "{ 3 2 -1 -2 3 0 4 1 } rev-haar ." "{ 7 1 6 6 3 -5 4 2 }" } } ;
diff --git a/extra/math/transforms/haar/haar.factor b/extra/math/transforms/haar/haar.factor
index c0359b8e7b..e9b430a802 100644
--- a/extra/math/transforms/haar/haar.factor
+++ b/extra/math/transforms/haar/haar.factor
@@ -8,7 +8,7 @@ IN: math.transforms.haar
 
 <PRIVATE
 
-: averages ( seq -- seq )
+: averages ( seq -- seq' )
     [ mean ] map ;
 
 : differences ( seq averages -- differences )
@@ -22,9 +22,9 @@ IN: math.transforms.haar
 
 PRIVATE>
 
-: haar ( seq -- seq )
+: haar ( seq -- seq' )
     dup length 1 <= [ haar-step haar prepend ] unless ;
 
-: rev-haar ( seq -- seq )
+: rev-haar ( seq -- seq' )
     dup length 2 > [ halves swap rev-haar prepend ] when rev-haar-step ;
 
diff --git a/extra/memory/piles/piles-docs.factor b/extra/memory/piles/piles-docs.factor
index 20568f2226..94a3e7736f 100644
--- a/extra/memory/piles/piles-docs.factor
+++ b/extra/memory/piles/piles-docs.factor
@@ -21,7 +21,6 @@ HELP: pile
 HELP: pile-align
 { $values
     { "pile" pile } { "align" "a power of two" }
-    { "pile" pile }
 }
 { $description "Adjusts a " { $link pile } "'s internal state so that the next call to " { $link pile-alloc } " will return a pointer aligned to " { $snippet "align" } " bytes relative to the pile's initial offset." } ;
 
diff --git a/extra/mongodb/driver/driver-docs.factor b/extra/mongodb/driver/driver-docs.factor
index 532dfe1dce..95acd523b3 100644
--- a/extra/mongodb/driver/driver-docs.factor
+++ b/extra/mongodb/driver/driver-docs.factor
@@ -49,7 +49,6 @@ HELP: <update>
 HELP: >upsert
 { $values
   { "mdb-update-msg" "a mdb-update-msg" }
-  { "mdb-update-msg" "mdb-update-msg with the upsert indicator set to t" }
 }
 { $description "Marks a mdb-update-msg as upsert operation"
   "(inserts object identified by the update selector if it doesn't exist in the collection)" } ;
@@ -162,7 +161,6 @@ HELP: hint
 { $values
   { "mdb-query-msg" "a query" }
   { "index-hint" "a hint to an index" }
-  { "mdb-query-msg" "modified query object" }
 }
 { $description "Annotates the query with a hint to an index. "
   "For detailed information see: " { $url "http://www.mongodb.org/display/DOCS/Optimizing+Mongo+Performance#OptimizingMongoPerformance-Hint" } }
@@ -183,7 +181,6 @@ HELP: limit
 { $values
   { "mdb-query-msg" "a query" }
   { "limit#" "number of objects that should be returned at most" }
-  { "mdb-query-msg" "modified query object" }
 }
 { $description "Limits the number of returned objects to limit#" }
 { $examples
@@ -243,7 +240,6 @@ HELP: skip
 { $values
   { "mdb-query-msg" "a query message" }
   { "skip#" "number of objects to skip" }
-  { "mdb-query-msg" "annotated query message" }
 }
 { $description "annotates a query message with a number of objects to skip when returning the results" } ;
 
@@ -251,7 +247,6 @@ HELP: sort
 { $values
   { "mdb-query-msg" "a query message" }
   { "sort-quot" "a quotation with sort specifiers" }
-  { "mdb-query-msg" "annotated query message" }
 }
 { $description "annotates the query message for sort specifiers" } ;
 
diff --git a/extra/spider/spider-docs.factor b/extra/spider/spider-docs.factor
index 83d93268b5..a39515379a 100644
--- a/extra/spider/spider-docs.factor
+++ b/extra/spider/spider-docs.factor
@@ -12,7 +12,6 @@ HELP: <spider>
 
 HELP: run-spider
 { $values
-     { "spider" spider }
      { "spider" spider } }
 { $description "Runs a spider until completion. See the " { $subsection "spider-tutorial" } " for a complete description of the tuple slots that affect how thet spider works." } ;
 

From c3de89c808ea483fc2d88e10596ccdf4d6a3eba3 Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Fri, 19 Feb 2010 12:32:03 +1300
Subject: [PATCH 02/13] help.lint.checks: you can't have duplicate names in
 $values anymore

---
 basis/help/lint/checks/checks.factor | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/basis/help/lint/checks/checks.factor b/basis/help/lint/checks/checks.factor
index 340f9b16d3..632cdb46e2 100644
--- a/basis/help/lint/checks/checks.factor
+++ b/basis/help/lint/checks/checks.factor
@@ -33,7 +33,7 @@ SYMBOL: vocab-articles
 
 : extract-values ( element -- seq )
     \ $values swap elements dup empty? [
-        first rest [ first ] map prune
+        first rest [ first ] map
     ] unless ;
 
 : effect-values ( word -- seq )

From 170f2b5eca702c863e38a4251b3997acef976ef7 Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Fri, 19 Feb 2010 18:24:23 +1300
Subject: [PATCH 03/13] game.input: fix load error on *BSD, remove dependency
 on windows.com from game.input.linux

---
 basis/game/input/input.factor       | 1 +
 basis/game/input/linux/linux.factor | 8 +++-----
 basis/game/input/linux/tags.txt     | 1 +
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/basis/game/input/input.factor b/basis/game/input/input.factor
index 7543a05c60..8a269cd51a 100644
--- a/basis/game/input/input.factor
+++ b/basis/game/input/input.factor
@@ -94,4 +94,5 @@ M: mouse-state clone
     { [ os windows? ] [ "game.input.xinput" require ] }
     { [ os macosx? ] [ "game.input.iokit" require ] }
     { [ os linux? ] [ "game.input.linux" require ] }
+    [ ]
 } cond
diff --git a/basis/game/input/linux/linux.factor b/basis/game/input/linux/linux.factor
index 465cefa84b..0d451e96f0 100644
--- a/basis/game/input/linux/linux.factor
+++ b/basis/game/input/linux/linux.factor
@@ -1,8 +1,6 @@
 ! Copyright (C) 2010 Erik Charlebois.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel game.input namespaces classes windows.com.syntax
-bit-arrays
-vectors ;
+USING: kernel game.input namespaces classes bit-arrays vectors ;
 IN: game.input.linux
 
 SINGLETON: linux-game-input-backend
@@ -25,10 +23,10 @@ M: linux-game-input-backend product-string
     drop "" ;
      
 M: linux-game-input-backend product-id
-    drop GUID: {00000000-0000-0000-0000-000000000000} ;
+    drop f ;
      
 M: linux-game-input-backend instance-id
-    drop GUID: {00000000-0000-0000-0000-000000000000} ;
+    drop f ;
      
 M: linux-game-input-backend read-controller
     drop controller-state new ;
diff --git a/basis/game/input/linux/tags.txt b/basis/game/input/linux/tags.txt
index 84d4140a70..82506ff250 100644
--- a/basis/game/input/linux/tags.txt
+++ b/basis/game/input/linux/tags.txt
@@ -1 +1,2 @@
+unportable
 games

From 48fe9029af23b64d8ba4df68c6e849704a847737 Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Fri, 19 Feb 2010 18:24:36 +1300
Subject: [PATCH 04/13] libusb: add unportable tag since it depends on the unix
 vocab

---
 extra/libusb/tags.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/extra/libusb/tags.txt b/extra/libusb/tags.txt
index bb863cf9a0..bf2a35f15b 100644
--- a/extra/libusb/tags.txt
+++ b/extra/libusb/tags.txt
@@ -1 +1,2 @@
 bindings
+unportable

From 7692bd1715db1a8cd5e12452f97bf7465ea73de0 Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Fri, 19 Feb 2010 21:45:43 +1300
Subject: [PATCH 05/13] concurrency.mailboxes: mailboxes should not be
 disposable, since futures and promises use them in a transient fashion,
 causing leaks

---
 .../mailboxes/mailboxes-tests.factor          | 35 -------------------
 basis/concurrency/mailboxes/mailboxes.factor  | 20 +++++------
 2 files changed, 9 insertions(+), 46 deletions(-)

diff --git a/basis/concurrency/mailboxes/mailboxes-tests.factor b/basis/concurrency/mailboxes/mailboxes-tests.factor
index 56d579d6c7..3435a01455 100644
--- a/basis/concurrency/mailboxes/mailboxes-tests.factor
+++ b/basis/concurrency/mailboxes/mailboxes-tests.factor
@@ -42,40 +42,6 @@ IN: concurrency.mailboxes.tests
     mailbox-get
 ] unit-test
 
-<mailbox> "m" set
-
-1 <count-down> "c" set
-1 <count-down> "d" set
-
-[
-    "c" get await
-    [ "m" get mailbox-get drop ]
-    [ drop "d" get count-down ] recover
-] "Mailbox close test" spawn drop
-
-[ ] [ "c" get count-down ] unit-test
-[ ] [ "m" get dispose ] unit-test
-[ ] [ "d" get 5 seconds await-timeout ] unit-test
-
-[ ] [ "m" get dispose ] unit-test
-
-<mailbox> "m" set
-
-1 <count-down> "c" set
-1 <count-down> "d" set
-
-[
-    "c" get await
-    "m" get wait-for-close
-    "d" get count-down
-] "Mailbox close test" spawn drop
-
-[ ] [ "c" get count-down ] unit-test
-[ ] [ "m" get dispose ] unit-test
-[ ] [ "d" get 5 seconds await-timeout ] unit-test
-
-[ ] [ "m" get dispose ] unit-test
-
 [ { "foo" "bar" } ] [
     <mailbox>
     "foo" over mailbox-put
@@ -86,4 +52,3 @@ IN: concurrency.mailboxes.tests
 [
     <mailbox> 1 seconds mailbox-get-timeout
 ] [ wait-timeout? ] must-fail-with
-    
diff --git a/basis/concurrency/mailboxes/mailboxes.factor b/basis/concurrency/mailboxes/mailboxes.factor
index 7834a2a3e1..06da3b34a6 100644
--- a/basis/concurrency/mailboxes/mailboxes.factor
+++ b/basis/concurrency/mailboxes/mailboxes.factor
@@ -1,17 +1,17 @@
-! Copyright (C) 2005, 2008 Chris Double, Slava Pestov.
+! Copyright (C) 2005, 2010 Chris Double, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: dlists deques threads sequences continuations
-destructors namespaces math quotations words kernel
-arrays assocs init system concurrency.conditions accessors
-debugger debugger.threads locals fry ;
+USING: dlists deques threads sequences continuations namespaces
+math quotations words kernel arrays assocs init system
+concurrency.conditions accessors debugger debugger.threads
+locals fry ;
 IN: concurrency.mailboxes
 
-TUPLE: mailbox < disposable threads data ;
-
-M: mailbox dispose* threads>> notify-all ;
+TUPLE: mailbox threads data ;
 
 : <mailbox> ( -- mailbox )
-    mailbox new-disposable <dlist> >>threads <dlist> >>data ;
+    mailbox new
+        <dlist> >>threads
+        <dlist> >>data ;
 
 : mailbox-empty? ( mailbox -- bool )
     data>> deque-empty? ;
@@ -24,14 +24,12 @@ M: mailbox dispose* threads>> notify-all ;
     [ threads>> ] dip "mailbox" wait ;
 
 :: block-unless-pred ( mailbox timeout pred: ( message -- ? ) -- )
-    mailbox check-disposed
     mailbox data>> pred dlist-any? [
         mailbox timeout wait-for-mailbox
         mailbox timeout pred block-unless-pred
     ] unless ; inline recursive
 
 : block-if-empty ( mailbox timeout -- mailbox )
-    over check-disposed
     over mailbox-empty? [
         2dup wait-for-mailbox block-if-empty
     ] [

From be8a0f777998a459a31a3fe606c9cd8723f66c33 Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Fri, 19 Feb 2010 21:45:50 +1300
Subject: [PATCH 06/13] concurrency.promises: fix formatting

---
 basis/concurrency/promises/promises.factor | 1 +
 1 file changed, 1 insertion(+)

diff --git a/basis/concurrency/promises/promises.factor b/basis/concurrency/promises/promises.factor
index 2ff338c4e3..3381bcc00b 100644
--- a/basis/concurrency/promises/promises.factor
+++ b/basis/concurrency/promises/promises.factor
@@ -12,6 +12,7 @@ TUPLE: promise mailbox ;
     mailbox>> mailbox-empty? not ;
 
 ERROR: promise-already-fulfilled promise ;
+
 : fulfill ( value promise -- )
     dup promise-fulfilled? [ 
         promise-already-fulfilled

From a615700af1f6d969b394ba8ea6a451025df2a7c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Br=C3=BCschweiler?= <blei42@gmail.com>
Date: Tue, 20 Oct 2009 13:55:29 +0200
Subject: [PATCH 07/13] ui.tools.listener docs: typo

---
 basis/ui/tools/listener/listener-docs.factor | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/basis/ui/tools/listener/listener-docs.factor b/basis/ui/tools/listener/listener-docs.factor
index b762e036e6..966ac37d30 100644
--- a/basis/ui/tools/listener/listener-docs.factor
+++ b/basis/ui/tools/listener/listener-docs.factor
@@ -9,7 +9,7 @@ HELP: interactor
 $nl
 "Interactors are created by calling " { $link <interactor> } "."
 $nl
-"Interactors implement the " { $link stream-readln } ", " { $link stream-read } " and " { $link read-quot } " generic words." } ;
+"Interactors implement the " { $link stream-readln } ", " { $link stream-read } " and " { $link stream-read-quot } " generic words." } ;
 
 ARTICLE: "ui-listener" "UI listener"
 "The graphical listener adds input history and word and vocabulary completion. See " { $link "listener" } " for general information on the listener."

From db663548f9cd4615c31efa81b1b109a12ca2cfba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Br=C3=BCschweiler?= <blei42@gmail.com>
Date: Wed, 21 Oct 2009 19:48:49 +0200
Subject: [PATCH 08/13] math: typo in rem docs

---
 core/math/math-docs.factor | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/math/math-docs.factor b/core/math/math-docs.factor
index 1e107124a2..6357c8bd98 100644
--- a/core/math/math-docs.factor
+++ b/core/math/math-docs.factor
@@ -212,7 +212,7 @@ HELP: recip
 HELP: rem
 { $values { "x" rational } { "y" rational } { "z" rational } }
 { $description
-    "Computes the remainder of dividing " { $snippet "x" } " by " { $snippet "y" } ", with the remainder always positive."
+    "Computes the remainder of dividing " { $snippet "x" } " by " { $snippet "y" } ", with the remainder always positive or zero."
     { $list 
         "Given fixnums, always yields a fixnum."
         "Given bignums, always yields a bignum."

From caf978588bf9521cde6a1d6d518c5954cb4d150e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Br=C3=BCschweiler?= <blei42@gmail.com>
Date: Thu, 18 Feb 2010 18:18:26 +0100
Subject: [PATCH 09/13] sequences: clarify some stack effect and examlpes in
 docs

---
 core/sequences/sequences-docs.factor | 30 ++++++++++++++--------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor
index 38eadc745d..dc26933af4 100644
--- a/core/sequences/sequences-docs.factor
+++ b/core/sequences/sequences-docs.factor
@@ -269,7 +269,7 @@ HELP: reduce
 
 HELP: reduce-index
 { $values
-     { "seq" sequence } { "identity" object } { "quot" quotation } }
+     { "seq" sequence } { "identity" object } { "quot" { $quotation "( prev elt index -- result )" } } }
 { $description "Combines successive elements of the sequence and their indices binary operations, and outputs the final result. On the first iteration, the three inputs to the quotation are " { $snippet "identity" } ", the first element of the sequence, and its index, 0. On successive iterations, the first input is the result of the previous iteration, the second input is the corresponding element of the sequence, and the third is its index." }
 { $examples { $example "USING: sequences prettyprint math ;"
     "{ 10 50 90 } 0 [ + + ] reduce-index ."
@@ -321,20 +321,20 @@ HELP: map-as
 
 HELP: each-index
 { $values
-     { "seq" sequence } { "quot" quotation } }
+     { "seq" sequence } { "quot" { $quotation "( elt index -- )" } } }
 { $description "Calls the quotation with the element of the sequence and its index on the stack, with the index on the top of the stack." }
-{ $examples { $example "USING: sequences prettyprint math ;"
-"{ 10 20 30 } [ + . ] each-index"
-"10\n21\n32"
+{ $examples { $example "USING: arrays sequences prettyprint ;"
+"{ 10 20 30 } [ 2array . ] each-index"
+"{ 10 0 }\n{ 20 1 }\n{ 30 2 }"
 } } ;
 
 HELP: map-index
 { $values
-  { "seq" sequence } { "quot" quotation } { "newseq" sequence } }
+  { "seq" sequence } { "quot" { $quotation "( elt index -- result )" } } { "newseq" sequence } }
 { $description "Calls the quotation with the element of the sequence and its index on the stack, with the index on the top of the stack. Collects the outputs of the quotation and outputs them in a sequence of the same type as the input sequence." }
-{ $examples { $example "USING: sequences prettyprint math ;"
-"{ 10 20 30 } [ + ] map-index ."
-"{ 10 21 32 }"
+{ $examples { $example "USING: arrays sequences prettyprint ;"
+"{ 10 20 30 } [ 2array ] map-index ."
+"{ { 10 0 } { 20 1 } { 30 2 } }"
 } } ;
 
 HELP: change-nth
@@ -995,8 +995,8 @@ HELP: count
 
 HELP: selector
 { $values
-     { "quot" "a predicate quotation" }
-     { "selector" quotation } { "accum" vector } }
+     { "quot" { $quotation "( elt -- ? )" } }
+     { "selector" { $quotation "( elt -- )" } } { "accum" vector } }
 { $description "Creates a new vector to accumulate the values which return true for a predicate.  Returns a new quotation which accepts an object to be tested and stored in the collector if the test yields true. The collector is left on the stack for convenience." }
 { $example "! Find all the even numbers:" "USING: prettyprint sequences math kernel ;"
            "10 iota [ even? ] selector [ each ] dip ."
@@ -1152,7 +1152,7 @@ HELP: replicate
 
 HELP: replicate-as
 { $values
-     { "len" integer } { "quot" quotation } { "exemplar" sequence }
+     { "len" integer } { "quot" { $quotation "( -- elt )" } } { "exemplar" sequence }
      { "newseq" sequence } }
  { $description "Calls the quotation " { $snippet "len" } " times, collecting results into a new sequence of the same type as the exemplar sequence." }
 { $examples 
@@ -1190,7 +1190,7 @@ HELP: virtual@
 
 HELP: 2map-reduce
 { $values
-     { "seq1" sequence } { "seq2" sequence } { "map-quot" quotation } { "reduce-quot" quotation }
+     { "seq1" sequence } { "seq2" sequence } { "map-quot" { $quotation "( elt1 elt2 -- intermediate )" } } { "reduce-quot" { $quotation "( prev intermediate -- result )" } }
      { "result" object } }
  { $description "Calls " { $snippet "map-quot" } " on each pair of elements from " { $snippet "seq1" } " and " { $snippet "seq2" } " and combines the results using " { $snippet "reduce-quot" } " in the same manner as " { $link reduce } ", except that there is no identity element, and the sequence must have a length of at least 1." }
 { $errors "Throws an error if the sequence is empty." }
@@ -1236,7 +1236,7 @@ HELP: collector
 
 HELP: binary-reduce
 { $values
-     { "seq" sequence } { "start" integer } { "quot" quotation }
+     { "seq" sequence } { "start" integer } { "quot" { $quotation "( elt1 elt2 -- newelt )" } }
      { "value" object } }
 { $description "Like " { $link reduce } ", but splits the sequence in half recursively until each sequence is small enough, and calls the quotation on these smaller sequences. If the quotation computes values that depend on the size of their input, such as bignum arithmetic, then this algorithm can be more efficient than using " { $link reduce } "." }
 { $examples "Computing factorial:"
@@ -1247,7 +1247,7 @@ HELP: binary-reduce
 
 HELP: follow
 { $values
-     { "obj" object } { "quot" quotation }
+     { "obj" object } { "quot" { $quotation "( prev -- result/f )" } }
      { "seq" sequence } }
 { $description "Outputs a sequence containing the input object and all of the objects generated by successively feeding the result of the quotation called on the input object to the quotation recursuively. Objects yielded by the quotation are added to the output sequence until the quotation yields " { $link f } ", at which point the recursion terminates." }
 { $examples "Get random numbers until zero is reached:"

From eb8344a5a5494276e5f7d5f16372d87364e6bdd9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Br=C3=BCschweiler?= <blei42@gmail.com>
Date: Thu, 18 Feb 2010 18:43:13 +0100
Subject: [PATCH 10/13] assocs: doc fixes

---
 core/assocs/assocs-docs.factor | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/assocs/assocs-docs.factor b/core/assocs/assocs-docs.factor
index 0d5a884832..8f93c5a9d1 100644
--- a/core/assocs/assocs-docs.factor
+++ b/core/assocs/assocs-docs.factor
@@ -221,7 +221,7 @@ HELP: assoc-size
 
 HELP: assoc-like
 { $values { "assoc" assoc } { "exemplar" assoc } { "newassoc" "a new assoc" } }
-{ $contract "Creates a new assoc having the same entries as  "{ $snippet "assoc" } " and the same type as " { $snippet "exemplar" } "." } ;
+{ $contract "Creates a new assoc having the same entries as " { $snippet "assoc" } " and the same type as " { $snippet "exemplar" } "." } ;
 
 HELP: assoc-empty?
 { $values { "assoc" assoc } { "?" "a boolean" } }
@@ -383,7 +383,7 @@ HELP: cache
 { $side-effects "assoc" } ;
 
 HELP: 2cache
-{ $values { "key1" "a key" } { "key2" "a key" } { "assoc" assoc } { "quot" { $quotation "( key -- value )" } } { "value" "a previously-retained or freshly-computed value" } }
+{ $values { "key1" "a key" } { "key2" "a key" } { "assoc" assoc } { "quot" { $quotation "( key1 key2 -- value )" } } { "value" "a previously-retained or freshly-computed value" } }
 { $description "If a single key composed of the input keys is present in the assoc, outputs the associated value, otherwise calls the quotation to produce a value and stores the keys/value pair into the assoc. Returns the value stored in the assoc. Returns a value either looked up or newly stored in the assoc." }
 { $side-effects "assoc" } ;
 
@@ -432,7 +432,7 @@ HELP: assoc-combine
 
 HELP: assoc-map-as
 { $values
-     { "assoc" assoc } { "quot" quotation } { "exemplar" assoc }
+     { "assoc" assoc } { "quot" { $quotation "( key value -- newkey newvalue )" } } { "exemplar" assoc }
      { "newassoc" assoc } }
 { $description "Applies the quotation to each entry in the input assoc and collects the results in a new assoc of the stame type as the exemplar." }
 { $examples { $example "USING: prettyprint assocs hashtables math ;" " H{ { 1 2 } { 3 4 } } [ sq ] { } assoc-map-as ." "{ { 1 4 } { 3 16 } }" } } ;

From aec0243f8331f69f2c71804e312b58baca56252a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Br=C3=BCschweiler?= <blei42@gmail.com>
Date: Thu, 18 Feb 2010 18:47:02 +0100
Subject: [PATCH 11/13] infix: part about integers as sequences doesn't apply
 anymore

---
 extra/infix/infix-docs.factor | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/extra/infix/infix-docs.factor b/extra/infix/infix-docs.factor
index 9c42bf256b..3885fcc613 100644
--- a/extra/infix/infix-docs.factor
+++ b/extra/infix/infix-docs.factor
@@ -65,14 +65,6 @@ $nl
     "[let { 1 2 3 4 } :> myarr [infix myarr[4/2]*3 infix] ] ."
     "9"
 }
-"Please note: in Factor " { $emphasis "fixnums are sequences too." } " If you are not careful with sequence accesses you may introduce subtle bugs:"
-{ $example
-    "USING: arrays infix locals ;"
-    ":: add-2nd-elements ( x y -- res )"
-    "    [infix x[1] + y[1] infix] ;"
-    "{ 1 2 3 } { 0 1 2 3 } add-2nd-elements ."
-    "3"
-}
 ;
 
 ABOUT: "infix"

From a343f8a31ccf418e39e0a5c5e18a9dfe51034efa Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@slava-pestovs-macbook-pro.local>
Date: Sat, 20 Feb 2010 00:23:24 +1300
Subject: [PATCH 12/13] io.monitors: if a monitor is disposed while other
 threads are waiting on it, an error will be thrown from next-change, instead
 of those threads hanging forever. This makes monitors consistent with streams
 and other native resources that behave in a similar manner

---
 basis/io/monitors/linux/linux.factor         |  4 +++-
 basis/io/monitors/macosx/macosx.factor       |  5 ++--
 basis/io/monitors/monitors-tests.factor      | 21 ++++++++++++++++-
 basis/io/monitors/monitors.factor            | 24 ++++++++++++++++----
 basis/io/monitors/recursive/recursive.factor |  2 +-
 basis/io/monitors/windows/nt/nt.factor       |  2 +-
 6 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/basis/io/monitors/linux/linux.factor b/basis/io/monitors/linux/linux.factor
index 7653eaa84c..eacc920303 100644
--- a/basis/io/monitors/linux/linux.factor
+++ b/basis/io/monitors/linux/linux.factor
@@ -59,7 +59,9 @@ M: linux-monitor dispose* ( monitor -- )
             [ inotify>> handle>> handle-fd ] [ wd>> ] bi
             inotify_rm_watch io-error
         ] if
-    ] bi ;
+    ]
+    [ call-next-method ]
+    tri ;
 
 : ignore-flags? ( mask -- ? )
     {
diff --git a/basis/io/monitors/macosx/macosx.factor b/basis/io/monitors/macosx/macosx.factor
index e71fb2eca2..dbbbe7c7e3 100644
--- a/basis/io/monitors/macosx/macosx.factor
+++ b/basis/io/monitors/macosx/macosx.factor
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: io.backend io.monitors
 core-foundation.fsevents continuations kernel sequences
@@ -16,6 +16,7 @@ M:: macosx (monitor) ( path recursive? mailbox -- monitor )
     dup [ enqueue-notifications ] curry
     path 1array 0 0 <event-stream> >>handle ;
 
-M: macosx-monitor dispose* handle>> dispose ;
+M: macosx-monitor dispose*
+    [ handle>> dispose ] [ call-next-method ] bi ;
 
 macosx set-io-backend
diff --git a/basis/io/monitors/monitors-tests.factor b/basis/io/monitors/monitors-tests.factor
index 576ac7ca30..ac17c4a39f 100644
--- a/basis/io/monitors/monitors-tests.factor
+++ b/basis/io/monitors/monitors-tests.factor
@@ -3,7 +3,7 @@ USING: io.monitors tools.test io.files system sequences
 continuations namespaces concurrency.count-downs kernel io
 threads calendar prettyprint destructors io.timeouts
 io.files.temp io.directories io.directories.hierarchy
-io.pathnames accessors ;
+io.pathnames accessors concurrency.promises ;
 
 os { winnt linux macosx } member? [
     [
@@ -110,4 +110,23 @@ os { winnt linux macosx } member? [
         [ [ t ] [ "m" get next-change drop ] while ] must-fail
         [ ] [ "m" get dispose ] unit-test
     ] with-monitors
+
+    ! Disposing a monitor should throw an error in any threads
+    ! waiting on notifications
+    [
+        [ ] [
+            <promise> "p" set
+            "monitor-test" temp-file t <monitor> "m" set
+            10 seconds "m" get set-timeout
+        ] unit-test
+
+        [
+            [ "m" get next-change ] [ ] recover
+            "p" get fulfill
+        ] in-thread
+
+        [ ] [ 1 seconds sleep ] unit-test
+        [ ] [ "m" get dispose ] unit-test
+        [ t ] [ "p" get 10 seconds ?promise-timeout already-disposed? ] unit-test
+    ] with-monitors
 ] when
diff --git a/basis/io/monitors/monitors.factor b/basis/io/monitors/monitors.factor
index cb2f552a32..731798c424 100644
--- a/basis/io/monitors/monitors.factor
+++ b/basis/io/monitors/monitors.factor
@@ -1,4 +1,4 @@
-! Copyright (C) 2008, 2009 Slava Pestov.
+! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: io.backend kernel continuations destructors namespaces
 sequences assocs hashtables sorting arrays threads boxes
@@ -26,6 +26,15 @@ M: monitor timeout timeout>> ;
 
 M: monitor set-timeout (>>timeout) ;
 
+<PRIVATE
+
+SYMBOL: monitor-disposed
+
+PRIVATE>
+
+M: monitor dispose*
+    [ monitor-disposed ] dip queue>> mailbox-put ;
+
 : new-monitor ( path mailbox class -- monitor )
     new-disposable
         swap >>queue
@@ -34,8 +43,11 @@ M: monitor set-timeout (>>timeout) ;
 TUPLE: file-change path changed monitor ;
 
 : queue-change ( path changes monitor -- )
-    3dup and and
-    [ [ file-change boa ] keep queue>> mailbox-put ] [ 3drop ] if ;
+    3dup and and [
+        [ check-disposed ] keep
+        [ file-change boa ] keep
+        queue>> mailbox-put
+    ] [ 3drop ] if ;
 
 HOOK: (monitor) io-backend ( path recursive? mailbox -- monitor )
 
@@ -43,7 +55,11 @@ HOOK: (monitor) io-backend ( path recursive? mailbox -- monitor )
     <mailbox> (monitor) ;
 
 : next-change ( monitor -- change )
-    [ queue>> ] [ timeout ] bi mailbox-get-timeout ;
+    [ check-disposed ]
+    [
+        [ ] [ queue>> ] [ timeout ] tri mailbox-get-timeout
+        dup monitor-disposed eq? [ drop already-disposed ] [ nip ] if
+    ] bi ;
 
 SYMBOL: +add-file+
 SYMBOL: +remove-file+
diff --git a/basis/io/monitors/recursive/recursive.factor b/basis/io/monitors/recursive/recursive.factor
index 33477abdb6..83c088e882 100644
--- a/basis/io/monitors/recursive/recursive.factor
+++ b/basis/io/monitors/recursive/recursive.factor
@@ -41,7 +41,7 @@ DEFER: add-child-monitor
 
 M: recursive-monitor dispose*
     [ "stop" swap thread>> send-synchronous drop ]
-    [ queue>> dispose ]
+    [ call-next-method ]
     bi ;
 
 : stop-pump ( -- )
diff --git a/basis/io/monitors/windows/nt/nt.factor b/basis/io/monitors/windows/nt/nt.factor
index 9cd8bc4df8..4d061cbb1a 100644
--- a/basis/io/monitors/windows/nt/nt.factor
+++ b/basis/io/monitors/windows/nt/nt.factor
@@ -100,4 +100,4 @@ M:: winnt (monitor) ( path recursive? mailbox -- monitor )
     ] with-destructors ;
 
 M: win32-monitor dispose
-    port>> dispose ;
+    [ port>> dispose ] [ call-next-method ] bi ;

From 5336d6f287fcbd59d59ca075ef29d67c1b0b84da Mon Sep 17 00:00:00 2001
From: Slava Pestov <slava@factorcode.org>
Date: Fri, 19 Feb 2010 07:36:12 -0500
Subject: [PATCH 13/13] io.monitors.recursive: fix hang introduced by recent
 io.monitors change

---
 basis/io/monitors/recursive/recursive.factor | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/basis/io/monitors/recursive/recursive.factor b/basis/io/monitors/recursive/recursive.factor
index 83c088e882..b573e2fa2b 100644
--- a/basis/io/monitors/recursive/recursive.factor
+++ b/basis/io/monitors/recursive/recursive.factor
@@ -39,17 +39,19 @@ DEFER: add-child-monitor
 : remove-child-monitor ( monitor -- )
     monitor tget children>> delete-at* [ dispose ] [ drop ] if ;
 
+SYMBOL: +stop+
+
 M: recursive-monitor dispose*
-    [ "stop" swap thread>> send-synchronous drop ]
-    [ call-next-method ]
-    bi ;
+    [ [ +stop+ ] dip thread>> send ] [ call-next-method ] bi ;
 
 : stop-pump ( -- )
     monitor tget children>> values dispose-each ;
 
 : pump-step ( msg -- )
-    [ [ monitor>> path>> ] [ path>> ] bi append-path ] [ changed>> ] bi
-    monitor tget queue-change ;
+    monitor tget disposed>> [ drop ] [
+        [ [ monitor>> path>> ] [ path>> ] bi append-path ] [ changed>> ] bi
+        monitor tget queue-change
+    ] if ;
 
 : child-added ( path monitor -- )
     path>> prepend-path add-child-monitor ;
@@ -69,8 +71,8 @@ M: recursive-monitor dispose*
     ] with with each ;
 
 : pump-loop ( -- )
-    receive dup synchronous? [
-        [ stop-pump t ] dip reply-synchronous
+    receive dup +stop+ eq? [
+        drop stop-pump
     ] [
         [ '[ _ update-hierarchy ] ignore-errors ] [ pump-step ] bi
         pump-loop