Sublist Pattern Matching



Hi All,

I am having some trouble with a particular prolog query. Yes it is for
an assignment, but I have been cracking my head for the past two days
trying to figure it out, and in any case it is but a small part of a
much larger assignment ;)

The situation is this ........ I have a set of facts

fact(fact1:1).
fact(fact2:1).
fact(fact3:1).
fact(fact1:2).
fact(fact2:2).
fact(fact3:2).
fact(fact1:3).
fact(fact2:3).
fact(fact3:3).

As you can see, the facts match a particular pattern ... i.e.
fact<n>:<x> ...... Given an input pattern (say Pattern or what you
will), I need to construct a predicate testPattern(Pattern) that will
return true if it can find a fact matching the input pattern.

testPattern(Pattern) :- ???

Note that this should be like a wildcard pattern match "Pattern*".

Any help would be appreciated.

.



Relevant Pages

  • Re: Wonder how long theyll think Waynker is funny
    ... there's a pattern or anything. ... just stick with the facts. ... An interesting leap of reasoning. ... You said the French won because they cheated. ...
    (rec.sport.rugby.union)
  • Re: [F77] storing bytes data
    ... I'm reporting the facts. ... but speculation is all it would be. ... If you think you can always stick any bit pattern in any data ... variables for my Hollerith data on some f66 machines because of ...
    (comp.lang.fortran)
  • Using Integers and Bit Manipulation
    ... can I do an assignment to iy without error? ... do simple assignments for the purpose of copying the bit pattern to ... pattern that doesn't fit the compiler/computers rules for a valid ...
    (comp.lang.fortran)
  • Re: Is this C program doing what it is supposed to do ?
    ... The pattern is the same. ... I've been mentioning all the time that my objection is to the general ... I'd probably write the assignment as a separate ...
    (comp.lang.c)
  • Re: thermit and aluminothermic for ferrotitanium
    ... Commerical ferrotitanium is 25-75% Ti. ... This pattern is known as theory, and is used to predict other ... patterns of facts, which may or may not turn out to be correct. ... is a fear of chemists, in particular, that this has already happened - to ...
    (rec.pyrotechnics)