Samantha2323
Programmer
Hello,
I am new in prolog ... I know how to solve simple list problems, but when it comes to complex problems I get stuck
I need to do this ... but I am stuck please guide how to start up
The map_pairs_to_kval_list predicate takes a list of <key,value> pairs and generates a list of values for each key, <key, val1, val2,...>, preserving the order of keys and values. For example:
?- map_pairs_to_kval_list([[jack,a], [jack,b], [jack,f], [jill,cplus],[jill,aminus],[jack,a],[jack,w],[jill,aminus]], X).
X = [[jack,a,b,f,a,w],[jill,cplus,aminus,aminus]]
Thank you
I am new in prolog ... I know how to solve simple list problems, but when it comes to complex problems I get stuck
I need to do this ... but I am stuck please guide how to start up
The map_pairs_to_kval_list predicate takes a list of <key,value> pairs and generates a list of values for each key, <key, val1, val2,...>, preserving the order of keys and values. For example:
?- map_pairs_to_kval_list([[jack,a], [jack,b], [jack,f], [jill,cplus],[jill,aminus],[jack,a],[jack,w],[jill,aminus]], X).
X = [[jack,a,b,f,a,w],[jill,cplus,aminus,aminus]]
Thank you