I have facts with numeric attributes (letters with assigned numeric values).
point(a, 1).
point(b, 3).
point(c, 3).
%etc for the rest of the alphabet
I need to write a programme in Prolog that would count these attributes in a list. Instead, now I only managed to count elements in the list, not their attributes. Could you give me any advice? That would help me a lot !
count_points([ ], 0).
count_points([H|T], Count) :-
count_points(T, Number),
Count is Number + 1.
The answer should reproduce following example input/output:
?- count_points([h,e,l,p], Score).
Score = 14.
I wrote 14, but it depends of the assigned number to the letter.