I have a problem with Prolog. If it was another language with an imperative paradigm would be easier for me, but that's not the point. There are several items, some of which have requirements to be obtained. For example, if I have item b means I already have item a.
to_get(b):-
need(a).
to_get(a3):-
need(a2),
need(a1).
So, I have a list with items. I have to check which items are there, and then check if each item's requirements is there as well. If it's not there, then I have to create a new list and add it there. And return this new list.
L1 = [b, a1, a3]
b needs a, but a isn't in L1, so that means it is in a new list, L2
L2 = [a, a2]
I hope it's not such a dumb question, I'm just new to prolog. Thanks