In a previous question on collecting terms for a multivariable polynomial, I answered with a solution that required a unused symbol to be used for a temporary substitution and back substitution.
It works and everything, but the problem is it depends on the behavior that a symbol is not defined. This is generally a bad idea because a user could have a legitimate use for the symbol we defined. It may even be in the polynomial in question.
This sort of thing can also come up in other contexts, when there may be a need for a temporary symbol. I know I've needed this before and I've often had to think of something random to use.
Is there any way I can get a unique and guaranteed-never-used symbol name for these things?
Module-Block, there are cases when you do needUnique, for example when you want to create some number of unique symbols, and that number is only known at run-time. One situation like that happens when we use dummy symbols to hide certain things from the pattern-matcher, as e.g. here: http://stackoverflow.com/questions/8700934/why-is-cases-so-slow-here-are-there-any-tricks-to-speed-it-up/8701756#8701756 – Leonid Shifrin Jan 18 '12 at 00:45Unique. – Mike Bailey Jan 18 '12 at 01:01