Skip to content

Commit 8203e02

Browse files
authored
Clarify docstring of operate_to (#143)
1 parent d194f98 commit 8203e02

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/interface.jl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,14 @@ end
306306
Modify the value of `output` to be equal to the value of `op(args...)`. Can
307307
only be called if `mutability(output, op, args...)` returns [`IsMutable`](@ref).
308308
309-
If `output === args[i]` for some `i`,
310-
* The user should expect to get an error. `operate!!` or `operate!` should be used instead.
311-
* Any method not supporting this case should throw an error.
312-
313-
For instance, in DynamicPolynomials, `operate_to!(p, +, p, q)` throws an
314-
error because otherwise, the algorithm would fill `p` while iterating over the
315-
terms of `p` and `q` hence it will never terminate. On the other hand
316-
`operate!(+, p, q)` uses a different algorithm that efficiently inserts
317-
the terms of `q` in the sorted list of terms of `p` with minimal displacement.
309+
If `output === args[i]` for some `i`, this function may throw an error. Use
310+
`operate!!` or `operate!` instead.
311+
312+
For example, in DynamicPolynomials, `operate_to!(p, +, p, q)` throws an error
313+
because otherwise, the algorithm would fill `p` while iterating over the terms
314+
of `p` and `q` hence it will never terminate. On the other hand
315+
`operate!(+, p, q)` uses a different algorithm that efficiently inserts the
316+
terms of `q` in the sorted list of terms of `p` with minimal displacement.
318317
"""
319318
function operate_to!(output, op::F, args::Vararg{Any,N}) where {F<:Function,N}
320319
return operate_to_fallback!(

0 commit comments

Comments
 (0)