Prolog has Single Sided Unification (SSU). If the code is determinate then one should consider refactoring the code to SSU. When refactoring code to SSU not all changes are straightforward.
Here is an patch showing parts of Red-Black trees being refactored to use SSU.