user2177322
user2177322

Reputation: 3

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?

Upvotes: 0

Views: 71

Answers (1)

Shmil The Cat
Shmil The Cat

Reputation: 4670

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

Upvotes: 1

Related Questions