2013-03-16 134 views
0

我有兩份清單,例如:序言 - 兩個列表

L1=[1,0,1,0,1,1] 
L2=[2,3,4,2,1,1] 

,我要檢查這樣的事情

if (L1[k]==0) 
sum=L2(k) 

有沒有辦法做到這一點使用序言?

回答

1
nth0(Ind, Lst, Elem) enables random access to the list elements under SWI-Prolog 
+0

謝謝,Shmil貓! – user2177322 2013-03-16 16:04:02