0

I'm trying to learn Prolog and got stuck on a very simple problem. I need a function that will take one list and appends its elements to other list creating list of lists from them.

Lets say list1=[A,B] and list2=[0,1,2]. I need to generate list3=[[A,B,0],[A,B,1],[A,B,2]].

I thought there would be a function that works like this as it looks really simple. I didn't found anything useful, so I wanted to implement it but I couldn't even do that. I got stuck with "iterating" over the list and got it only working when list2 would be just an atom using maplist.

If anyone could show me how to do that I would be very grateful. Thank you.

false
  • 10,264
  • 13
  • 101
  • 209
Ondřej
  • 13
  • 2

0 Answers0