This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*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 |