When I used the code though there ara no I won't get anwser.I couldn't whatis the error I did.

vowel([a],Counter):-Counter is 1.
vowel([e],Counter):-Counter is 1.
vowel([i],Counter):-Counter is 1.
vowel([o],Counter):-Counter is 1.
vowel([u],Counter):-Counter is 1.
vowel([_];[],Counter):-Counter is 0.
cvowel([H|T],Counter1):-cvowel(T,Count),vowel(H,Counter),Count is Count

+Counter,Counter1 is Counter1+Count.

answer I got "Faulse"

Count is Count in your clause in line 8 does not make sense for me, why :- Counter is 1.?
Why not simple facts like line 1?


I thought that both gives the same meaning

They do, but vowel([a], 1) is shorter.

Count is Count in your clause in line 8 does not make sense for me

Actually it's saying Count is Count + Counter (the lines are broken funnily), but that doesn't make sense either. Once a variable has been given a value, you can't just give it a new value. It will keep that value as long as it lives (or until Prolog backtracks back to a point before the variable has been given a value).

Something like X is X+Y will always be false unless Y is 0, in which case it will be true. Either way it will never change the value of X.

PS: This has also been asked and partially answered here: http://www.dreamincode.net/forums/topic/323595-count-vowels-in-a-list-prolog/

thank you..................

Can you fixed the error

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.