prologeclipse-clp

The difference between dollar sign ($) and number (or hash) sign (#) in Prolog


As I found I can use from $ and # in the shortened version of the suspend in Prolog. Hence, I can write the following query:

?- X $> 2, X = 2.5.

And the result is:

X = 2.5
Yes (0.11s cpu)

So what is the difference between # and $ and why the result of the following query:

?- X #> 2, X = 2.5.

is:

No (0.02s cpu)

?


Solution

  • Both of them used for the suspension in the prolog in lib(suspend). However, the difference is $ for the real numbers and # is for integers. Hence, the query X #> 2, X = 2.5. was rejected. For example for the query of X #> 2, X = 3. you will get yes and it is the same for the general case X $> 2, X = 3.