Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ isrealpart
isimagpart
isconj
ordinary_variable
is_commutative
```

## Monomials
Expand Down
11 changes: 11 additions & 0 deletions src/variable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ This operation is not type stable for the TypedPolynomials implementation if `nv
"""
variable(t::_APL) = convert(variable_union_type(t), t)

"""
is_commutative(::Type{<:AbstractVariable})::Bool

Returns whether variables of the given type are commutative, i.e., whether
`x * y == y * x`.
"""
function is_commutative end
is_commutative(p::_APL) = is_commutative(typeof(p))
is_commutative(v::AbstractVector) = is_commutative(eltype(v))
is_commutative(v::Tuple) = all(is_commutative, v)

"""
name(v::AbstractVariable)::AbstractString

Expand Down
Loading