include_template( 'topper.html' ); ?> CS 3304 semester(); ?> Homework Assignment 7 include_template( 'page-start.html' ); ?>
Note: The following instructions are repeated from the Homework Dates/Guidelines page:
Your solutions for each homework assignment must be prepared with a word processor (e.g., LaTeX or Word), and are due at the beginning of class on the due date specified unless otherwise noted on the assignment itself.
Note that all homework problems taken from the text are in the Problem Sets. Do not turn in solutions to Review Questions by mistake!
Complete each of the following problems:
Write an
equivalent Prolog predicate called remove_everwhere
that
takes three arguments:
remove_everywhere( Value, The_List, List_Without_Value ) :- /* Your implementation should ensure that List_Without_Value is the same as The_List, with all occurrences of Value removed, no matter how deeply nested. */ .
Try out your predicate to ensure it works correctly. Then try it out with this goal and place the result in your homework solution:
?- remove_everywhere(99, List, [a,[b,[c]],d]), fail.
Describe what result your predicate produces and explain its behavior in this case.
include_template( 'page-end.html' ); ?>