So basically I'm trying to find the second minimal value in a list, and the problem is that mino and secondMin return false, instead of numbers. When I do minlist(List, Min) manually, it returns Min = number, but I can't get sec to take on that value. Instead, it stays false. Can anyone help?
Second Minimum
secondMin(L, Min2):-
minlist(L,Min),
delete(L,Min,Li), %no prob ver
mino(L, k), %return k as the 2nd minimum of L
Min2 is k. %Min2 is k.
//////////some code here////////////
mino(List, sec):-
sec is minlist(List, Min). %min 2 is the minimum of Li