Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

prolog matching from the right

Status
Not open for further replies.

kuntilanak

IS-IT--Management
Oct 29, 2008
2
US
I have a function called :

match_pre([test], K) :- !, append([S|T],_, K), length([S|T],1), test(S)

and I have a huge database of predicates which succeeds if S is in the database, example:

test(a).
test(b).
test(z).
test(u).
test(h).
etc......

Now I want to create another function that matches from right to left, how can I do that? In other words,
say the function is called match_suf([test], ).

I want it to say:

true;
no

I want to match is a [test], instead of doing it the original left to right way
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top