0
votes

I'm brand new to prolog and I'm trying to match something along the lines of this:

rule(blah Variable, ...).

Basically I'm trying to match the atom "blah" followed by any expression. Is this possible?

1
Doesn't seem possible. Explain what you want to do and maybe we can assist with the correct syntax. - Vincent Ramdhanie

1 Answers

0
votes

If you are using SWI you can use atom_concat/3:

rule(X, ....):-
  atom_concat(blah, Y, X),
   ...

e.g.: Suppose X=blahsomethingelse then atom_concat(blah, Y, X) will instantiate Y with somethingelse. Note that atom_concat works only with atoms.