@@ -7,11 +7,18 @@ MP.substitute(st::MP.AbstractSubstitutionType, v::Variable, s::Substitution) = v
7
7
MP. substitute (st:: MP.AbstractSubstitutionType , v:: Variable{Name} , s:: Substitution{Name} , :: MP.AbstractSubstitution... ) where {Name} = s. second
8
8
9
9
_remove_variable (t:: Tuple{} , :: Type ) = t
10
- _remove_variable (t:: Tuple{V,Vararg{Variable,N}} , :: Type{V} ) where {V,N} = Base. tail (t)
11
- _remove_variable (t:: Tuple{V,Vararg{Variable,N}} , :: Type{W} ) where {V,W,N} = tuple (first (t), _remove_variable (Base. tail (t), V)... )
10
+ function _remove_variable (t:: Tuple{V,Vararg{Variable,N}} , :: Type{V} ) where {V,N}
11
+ Base. tail (t)
12
+ end
13
+ function _remove_variable (t:: Tuple{V,Vararg{Variable,N}} , :: Type{W} ) where {V,W,N}
14
+ tuple (first (t), _remove_variable (Base. tail (t), W)... )
15
+ end
16
+
17
+ _mult_monomial_type (:: Type{U} , :: Tuple{} ) where {U} = U
18
+ _mult_monomial_type (:: Type{U} , V:: Tuple ) where {U} = MA. promote_operation (* , U, Monomial{V,length (V)})
12
19
13
20
function MA. promote_operation (:: typeof (MP. substitute), :: Type{MP.Subs} , :: Type{Monomial{V,N}} , :: Type{Pair{Variable{Name},T}} ) where {V,N,Name,T}
14
- U = MA. promote_operation (^ , T, Int )
21
+ U = MA. promote_operation (* , T, T )
15
22
VV = _remove_variable (V, Variable{Name})
16
- return Term{U,Monomial{VV, length (VV)}}
23
+ return _mult_monomial_type (U, VV)
17
24
end
0 commit comments