yasseen
yasseen

Reputation: 101

Prolog remove items from a list

I know how to delete an items from a normal list like this one [1,2,3,4], but how can I delete the first number from a list that looks like this:

[(1,2), (3,4), (5,6), (7,8)....]

to give:

[2,4,6,8,...]

Thanks in advance!

Upvotes: 1

Views: 90

Answers (1)

Taku Koyahata
Taku Koyahata

Reputation: 558

does this work?(I didn't test this code):

maplist(nth1(1),[[1,2],[3,4],[5,6],[7,8]],Ret).

or

maplist(arg(1),[(1,2),(3,4),(5,6),(7,8)],Ret).

Upvotes: 3

Related Questions