Sublist Pattern Matching
- From: "Ka0s" <tushar.saxena@xxxxxxxxx>
- Date: 24 Nov 2005 23:31:10 -0800
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.
.
- Follow-Ups:
- Re: Sublist Pattern Matching
- From: Geoffrey Summerhayes
- Re: Sublist Pattern Matching
- From: Ka0s
- Re: Sublist Pattern Matching
- Prev by Date: Re: java calling prolog
- Next by Date: Re: Sublist Pattern Matching
- Previous by thread: Prolog and the web
- Next by thread: Re: Sublist Pattern Matching
- Index(es):
Relevant Pages
|