Old vs new spec of numbervars/4: How to get the old behavior?

Hi,
I’m using SWI-Prolog (Multi-threaded, 64 bits, Version 7.2.3)

I want the code to “freeze” (instantiate) the variables by constants of the form x1, x2, etc.
For example: foo(X,Y) would become foo(x1,x2).

From an old log-file I know that “this used to work once upon a time” :wink:
Welcome to SWI-Prolog (Multi-threaded, Version 5.6.49)
Copyright (c) 1990-2007 University of Amsterdam.

But what I’m getting with a more recent version (7.2.3) is this:

ERROR: numbervars/4: Type error: integer’ expected, found '$x'' (an atom)

My code looks like this:

	numbervars(Q1P, '$x',1,_),

I suspect that the specification / implementation of

  • numbervars/4

has changed!? Can I still get the “old behavior” somehow?

Thanks, cheers,

Bertram

Use the functor_name(’$x’) option to numbervars/4?

1 Like

This worked like a charm! Thanks for the quick response. Here it is:

Before:
numbervars(Q1P, '$x',1,_)

after:
numbervars(Q1P, 1,_, [functor_name('$x')])

… so something must have changed in the last 10 years or so :wink:

Bertram