diff --git a/doc/reference/matches.xml b/doc/reference/matches.xml
index d6f19ae..a666036 100644
--- a/doc/reference/matches.xml
+++ b/doc/reference/matches.xml
@@ -287,8 +287,8 @@ struct IsIntegral2 :
             When applying
             <computeroutput>proto::or_&lt;G<subscript>0</subscript>,G<subscript>1</subscript>,...G<subscript>n</subscript>&gt;</computeroutput>
             as a transform with an expression <computeroutput>e</computeroutput> of type <computeroutput>E</computeroutput>,
-            state <computeroutput>s</computeroutput> and data <computeroutput>v</computeroutput>, it is equivalent to
-            <computeroutput>G<subscript>x</subscript>()(e, s, v)</computeroutput>, where
+            state <computeroutput>s</computeroutput> and data <computeroutput>d</computeroutput>, it is equivalent to
+            <computeroutput>G<subscript>x</subscript>()(e, s, d)</computeroutput>, where
             <computeroutput>x</computeroutput> is the lowest number such that
             <computeroutput><classname>proto::matches</classname>&lt;E, G<subscript>x</subscript>&gt;::value</computeroutput>
             is <computeroutput>true</computeroutput>.
@@ -370,8 +370,8 @@ struct IsIntegral2 :
             When applying
             <computeroutput>proto::and_&lt;G<subscript>0</subscript>,G<subscript>1</subscript>,...G<subscript>n</subscript>&gt;</computeroutput>
             as a transform with an expression <computeroutput>e</computeroutput>, state
-            <computeroutput>s</computeroutput> and data <computeroutput>v</computeroutput>, it is equivalent
-            to <computeroutput>G<subscript>n</subscript>()(e, s, v)</computeroutput>.
+            <computeroutput>s</computeroutput> and data <computeroutput>d</computeroutput>, it is equivalent
+            to <computeroutput>G<subscript>n</subscript>()(e, s, d)</computeroutput>.
           </para>
           <para>
             The maximun number of template arguments <computeroutput>proto::and_&lt;&gt;</computeroutput> accepts
@@ -444,8 +444,8 @@ struct IsIntegral2 :
             When applying <computeroutput>proto::switch_&lt;C&gt;</computeroutput> as a transform
             with an expression <computeroutput>e</computeroutput> of type
             <computeroutput>E</computeroutput>, state <computeroutput>s</computeroutput> and
-            data <computeroutput>v</computeroutput>, it is equivalent to
-            <computeroutput>C::case_&lt;E::proto_tag&gt;()(e, s, v)</computeroutput>.
+            data <computeroutput>d</computeroutput>, it is equivalent to
+            <computeroutput>C::case_&lt;E::proto_tag&gt;()(e, s, d)</computeroutput>.
           </para>
         </description>
         <struct name="impl">
@@ -517,7 +517,7 @@ struct IsIntegral2 :
           </para>
           <para>For example:</para>
           <para>
-            <programlisting>// Match any function call expression, irregardless
+            <programlisting>// Match any function call expression, regardless
 // of the number of function arguments:
 struct Function :
   <classname>proto::function</classname>&lt; proto::vararg&lt;proto::_&gt; &gt;
diff --git a/doc/reference/transform/fold.xml b/doc/reference/transform/fold.xml
index 8d91476..90905f5 100644
--- a/doc/reference/transform/fold.xml
+++ b/doc/reference/transform/fold.xml
@@ -52,7 +52,7 @@
             <type>typename boost::result_of&lt;Y(Expr, State, Data)&gt;::type</type>
           </typedef>
           <typedef name="fun">
-            <purpose><computeroutput>fun(v)(e,s) == when&lt;_,Fun&gt;()(e,s,v)</computeroutput></purpose>
+            <purpose><computeroutput>fun(d)(s,e) == when&lt;_,Fun&gt;()(e,s,d)</computeroutput></purpose>
             <type><emphasis>unspecified</emphasis></type>
           </typedef>
           <typedef name="result_type">
@@ -86,7 +86,7 @@
                   let <computeroutput>state0</computeroutput> be
                   <computeroutput><classname>when</classname>&lt;<classname>_</classname>, State0&gt;()(expr, state, data)</computeroutput>,
                   and let <computeroutput>fun(data)</computeroutput> be an object such that
-                  <computeroutput>fun(data)(expr, state)</computeroutput> is equivalent to
+                  <computeroutput>fun(data)(state, expr)</computeroutput> is equivalent to
                   <computeroutput><classname>when</classname>&lt;<classname>_</classname>, Fun&gt;()(expr, state, data)</computeroutput>. Then,
                   this function returns <computeroutput>fusion::fold(seq, state0, fun(data))</computeroutput>.
                 </para>
diff --git a/doc/reference/transform/when.xml b/doc/reference/transform/when.xml
index 859e305..6044c57 100644
--- a/doc/reference/transform/when.xml
+++ b/doc/reference/transform/when.xml
@@ -48,8 +48,8 @@ struct CountLeaves :
             </listitem>
             <listitem>
               <para>
-                <computeroutput>proto::when&lt;G,T&gt;()(e,s,v)</computeroutput> is the same as
-                <computeroutput>T()(e,s,v)</computeroutput>.
+                <computeroutput>proto::when&lt;G,T&gt;()(e,s,d)</computeroutput> is the same as
+                <computeroutput>T()(e,s,d)</computeroutput>.
               </para>
             </listitem>
           </itemizedlist>
diff --git a/include/boost/proto/matches.hpp b/include/boost/proto/matches.hpp
index d2c5086..690e9a4 100644
--- a/include/boost/proto/matches.hpp
+++ b/include/boost/proto/matches.hpp
@@ -725,8 +725,8 @@
             /// matches any \c Bx for \c x in <tt>[0,n)</tt>.
             ///
             /// When applying <tt>or_\<B0,B1,...Bn\></tt> as a transform with an
-            /// expression \c e of type \c E, state \c s and data \c v, it is
-            /// equivalent to <tt>Bx()(e, s, v)</tt>, where \c x is the lowest
+            /// expression \c e of type \c E, state \c s and data \c d, it is
+            /// equivalent to <tt>Bx()(e, s, d)</tt>, where \c x is the lowest
             /// number such that <tt>matches\<E,Bx\>::::value</tt> is \c true.
             template<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_LOGICAL_ARITY, typename G)>
             struct or_ : transform<or_<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_LOGICAL_ARITY, G)> >
@@ -761,8 +761,8 @@
             /// matches all \c Bx for \c x in <tt>[0,n)</tt>.
             ///
             /// When applying <tt>and_\<B0,B1,...Bn\></tt> as a transform with an
-            /// expression \c e, state \c s and data \c v, it is
-            /// equivalent to <tt>Bn()(e, s, v)</tt>.
+            /// expression \c e, state \c s and data \c d, it is
+            /// equivalent to <tt>Bn()(e, s, d)</tt>.
             template<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_LOGICAL_ARITY, typename G)>
             struct and_ : transform<and_<BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_LOGICAL_ARITY, G)> >
             {
@@ -795,8 +795,8 @@
             /// matches <tt>C::case_\<E::proto_tag\></tt>.
             ///
             /// When applying <tt>switch_\<C\></tt> as a transform with an
-            /// expression \c e of type \c E, state \c s and data \c v, it is
-            /// equivalent to <tt>C::case_\<E::proto_tag\>()(e, s, v)</tt>.
+            /// expression \c e of type \c E, state \c s and data \c d, it is
+            /// equivalent to <tt>C::case_\<E::proto_tag\>()(e, s, d)</tt>.
             template<typename Cases>
             struct switch_ : transform<switch_<Cases> >
             {
diff --git a/include/boost/proto/transform/fold.hpp b/include/boost/proto/transform/fold.hpp
index 371e86f..324a86b 100644
--- a/include/boost/proto/transform/fold.hpp
+++ b/include/boost/proto/transform/fold.hpp
@@ -30,8 +30,8 @@
             template<typename Transform, typename Data>
             struct as_callable
             {
-                as_callable(Data v)
-                  : v_(v)
+                as_callable(Data d)
+                  : d_(d)
                 {}
 
                 template<typename Sig>
@@ -51,7 +51,7 @@
                 typename when<_, Transform>::template impl<Expr &, State const &, Data>::result_type
                 operator ()(State const &s, Expr &e) const
                 {
-                    return typename when<_, Transform>::template impl<Expr &, State const &, Data>()(e, s, this->v_);
+                    return typename when<_, Transform>::template impl<Expr &, State const &, Data>()(e, s, this->d_);
                 }
 
                 #else
@@ -74,7 +74,7 @@
                 #endif
 
             private:
-                Data v_;
+                Data d_;
             };
 
             template<
@@ -190,7 +190,7 @@
                     >::type
                 state0;
 
-                /// \brief <tt>fun(v)(e,s) == when\<_,Fun\>()(e,s,v)</tt>
+                /// \brief <tt>fun(d)(e,s) == when\<_,Fun\>()(e,s,d)</tt>
                 typedef
                     detail::as_callable<Fun, Data>
                 fun;
diff --git a/include/boost/proto/transform/when.hpp b/include/boost/proto/transform/when.hpp
index e95cc10..04e32c1 100644
--- a/include/boost/proto/transform/when.hpp
+++ b/include/boost/proto/transform/when.hpp
@@ -49,8 +49,8 @@
         /// <tt>boost::result_of\<when\<G,T\>(E,S,V)\>::::type</tt> is the same as
         /// <tt>boost::result_of\<T(E,S,V)\>::::type</tt>.
         ///
-        /// <tt>when\<G,T\>()(e,s,v)</tt> is the same as
-        /// <tt>T()(e,s,v)</tt>.
+        /// <tt>when\<G,T\>()(e,s,d)</tt> is the same as
+        /// <tt>T()(e,s,d)</tt>.
         template<typename Grammar, typename PrimitiveTransform /*= Grammar*/>
         struct when
           : PrimitiveTransform