I have a problem with list of lists in Prolog. For example, I have these facts:
fact(1, 'hello').
fact(2, 'boy').
fact(3, 'hello').
fact(4, 'girl').
and a list made of pairs like (Character, Id):
list([b, 1, b, 2, g, 3, g, 4]).
my goal is to return a list of lists like this:
newList(['hello', boy'], ['hello', 'girl']).
EDIT: The first list have to be split in more lists that share the same Character
list([b, 1, b, 2], [g, 3, g, 4]).
then, should be removed the Character
list([1, 2], [3, 4]).
and substitute the id with the corresponding atom like this:
list(['hello', 'boy'], ['hello', 'girl']).
factuse 'boy' and 'girl' instead of 'b' and 'g'? Also, seems to be some implicit knowledge built into this scheme that says even numbers are gender, and odd numbers are something else. - lurker