Skip to content

Instantly share code, notes, and snippets.

@hackerghost93
hackerghost93 / average.pl
Created Apr 1, 2016
Some list operation implemented in Prolog.
View average.pl
/*This to call the outside function .. the inside function "average"
calculate the result and give it back to the outside function
"avg"
*/
avg(List,Ans):-
Count is 0,
Sum is 0 ,
average(List,Count,Sum,Ans).
/* This is the most important line you need to handle base case well use trace command in SWI-PROLOG