Skip to content

Instantly share code, notes, and snippets.

@GeoffChurch
Last active October 17, 2022 22:00
Show Gist options
  • Save GeoffChurch/81dd8224680d5b93111c131999df0a1a to your computer and use it in GitHub Desktop.
Save GeoffChurch/81dd8224680d5b93111c131999df0a1a to your computer and use it in GitHub Desktop.
copy_term(VarsIn, In, VarsOut, Out) :-
term_variables(In, AllVarsIn),
maplist(list_to_ord_set, [AllVarsIn, VarsIn], [AllVarsInOrdSet, VarsInOrdSet]),
ord_subtract(AllVarsInOrdSet, VarsInOrdSet, PreservedVars),
copy_term(PreservedVars-VarsIn-In, PreservedVars-VarsOut-Out).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment