Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hackerghost93's full-sized avatar

Ahmed Wael Said hackerghost93

View GitHub Profile
@hackerghost93
hackerghost93 / average.pl
Created April 1, 2016 12:11
Some list operation implemented in Prolog.
/*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