Marcin
Marcin

Reputation: 430

prolog single quote (') unification

I'm trying to unify variable X with '*' (including the quote marks, for a total of 3-symbol string) What I'm doing is a simple X='*'., but that results in X having the value *. If I go for X=''*''., the result is X=''*''. I'm confused, how can I achieve the '*'?

Upvotes: 1

Views: 509

Answers (1)

Scott Hunter
Scott Hunter

Reputation: 49813

If you truly want a string, you should use double-quotes:

X="'*'".

If you want to make a symbol, you can use

atom_codes( X, "'*'" ).

Upvotes: 2

Related Questions