sum([],0).
sum([H|T],S) : - sum(T,X),S is X+H.
mean([],0).
mean(L,M) : - sum(L,S),length(L,L1),M is S/L1.
:-arithmetic_function(mean/1).
---------------------------------------
when i try mean([1,2,3,4],X).
it replies with
X= 2.5
Yes
///////////////////////////////////////////
Now I wanna Use...