Define a recursive Prolog rules removethemLst Lst Result where Result is a list of the elements of the list Lst that do not appear in the list Lst
Write a Prolog rule cleanlist where the first argument is a list and the nd argument is a list of the numbers in the list. You will use this for # & #
For example:
cleanlisttwo,'three',four,X
X
Write a Prolog rule getvalues which replaces all sublists of the first argument with the sum of its elements.
For example:
getvalues
In football, a touchdown is points, a field goal is points, a safety is points and an extra point is point. Also, the number of extra points must be less than or equal to the number of touchdowns. Write a prolog rule called fbscore which has as arguments the number of touchdowns, field goals, safeties, extra points, and total points in a football game. For simplicity, you can assume that there is some maximum number of each type of scoring. You should not assume any particular variable is ground. For example:
fbscore X
X
fbscoreT F S X
T F F X X
S
We flatten a list L by first removing all lists within L and replacing them with their members. Write a Prolog rule flattenit which flattens a list. For example:
: flattenitabcdefc a babcdefcab
: flattenit
: flattenit
Note: there is a builtin called flatten you should not use that in your answer