简体   繁体   中英

Prolog - two lists

I have two lists, for example:

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

and I want to check something like this

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

Is there any way to do that using prolog?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM