parsing in prolog

I am having a difficult time to create a parser in prolog that will allow me to do this:

say I have a database of vowels:

vowel(a).
vowel(i).
vowel(u).
vowel(e).
vowel(o).

I want to create a function called match([vowel], [.....]). The dotted lines means that it's a  list of characters that will be tested if they are vowels or not. The function will return true if the entire character list contains one or more vowels found in the database. An example of an complex expression:

match([vowel], [e,e,e])

will result in:

true?;
true?;
true?;
no

notice that it returns true three times as vowel can match one or more vowels.. it can match [e]. [e,e] and [e,e,e]. I am having a difficult time coding it... can someone please help me out?

another example to make it much clear:

match([vowel], [e,e,k])

results in:

true?;
true?;
no

one other thing to consider is that I will have another patttern as well besides vowel, one of them is called cons1, which matches exactly one consonant.. we can combine both patterns, vowel and cons1. As an example:

match([vowel, cons1], [a,e,e,k]), will return:

true?;
no


that's the part where I am confused at... so far my code is

which works if pattern is only vowel, but if you put vowel and cons1 (i.e. like the example above) it doesn't work.. that's where I need help I think..
prefix_match([vowel|T], [H|_] ) :- vowel(H).
prefix_match([vowel|T], [H|T1] ) :- vowel(H), prefix_match([vowel|T], T1).

Open in new window

kuntilanakAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.