minimum

minimum in list of lists in prolog

ぃ、小莉子 提交于 2021-01-03 22:28:38
问题 hello i have a list like this: [[3,[a,b,c,d]],[2,[a,b,d]],[5,[d,e,f]]] list of lists... i want to find the minimum number on inner list in this case i want to return D=2 and L=[a,b,d] i tried this code: minway([[N|L]],N,L). minway([[M|L1]|L2],D,_):- M<D, minway(L2,M,L1). minway([[M|_]|L2],D,L):- M>=D, minway(L2,D,L). but i got error: </2: Arguments are not sufficiently instantiated Exception: (8) minway([[3,[a,b,c,d]],[2,[a,b,d]],[5,[d,e,f]]], _G7777, _G7778) ? creep for this run sentence:

minimum in list of lists in prolog

断了今生、忘了曾经 提交于 2021-01-03 22:28:37
问题 hello i have a list like this: [[3,[a,b,c,d]],[2,[a,b,d]],[5,[d,e,f]]] list of lists... i want to find the minimum number on inner list in this case i want to return D=2 and L=[a,b,d] i tried this code: minway([[N|L]],N,L). minway([[M|L1]|L2],D,_):- M<D, minway(L2,M,L1). minway([[M|_]|L2],D,L):- M>=D, minway(L2,D,L). but i got error: </2: Arguments are not sufficiently instantiated Exception: (8) minway([[3,[a,b,c,d]],[2,[a,b,d]],[5,[d,e,f]]], _G7777, _G7778) ? creep for this run sentence:

minimum in list of lists in prolog

亡梦爱人 提交于 2021-01-03 22:27:14
问题 hello i have a list like this: [[3,[a,b,c,d]],[2,[a,b,d]],[5,[d,e,f]]] list of lists... i want to find the minimum number on inner list in this case i want to return D=2 and L=[a,b,d] i tried this code: minway([[N|L]],N,L). minway([[M|L1]|L2],D,_):- M<D, minway(L2,M,L1). minway([[M|_]|L2],D,L):- M>=D, minway(L2,D,L). but i got error: </2: Arguments are not sufficiently instantiated Exception: (8) minway([[3,[a,b,c,d]],[2,[a,b,d]],[5,[d,e,f]]], _G7777, _G7778) ? creep for this run sentence: