How do i add current and previous in Prolog? Beginner prolog

calcHeu([],K) :- nl.
calcHeu([X|Rest],K) :-

if i pass [[1,2,3],[5,4,9],[7,8,9]] it will print 1 4 7 which is minimum of each list i want to add these value and return them. in a list or as single value.


I think this is what you want. Adding Y to a list everytime.

calcHeu([],K,List) :- nl.
calcHeu([X|Rest],K,[Y|Tail]) :-

Do you really need the K variable? Doesn't seem to do much.

Need Your Help

Addslashes safe to protect against xss in array?

php javascript arrays xss

Came across some code today that had a javascript array, made in php, using only php's addslashes() to sanitize. At first I thought this was an easy XSS vulnerability, but I haven't been able to se...