Prolog - Sum up "positioned" elem in list
Posted
by wOOt
on Stack Overflow
See other posts from Stack Overflow
or by wOOt
Published on 2010-04-28T11:02:19Z
Indexed on
2010/04/28
11:13 UTC
Read the original article
Hit count: 144
prolog
Hi guys, any solution to this problem - given a list of numbers [1,2,3,4,5] write a Prolog program to sum up all the odd-positioned in this list ?
odd([1,2,3,4,5],Sum)
Sum = 9. (1+3+5)
© Stack Overflow or respective owner