Question: PROLOG Define a predicate position(Subterm,Term,Position), where Position is a list of argument positions identifying Subterm within Term. For example, the position of X in 2sin(X)
Define a predicate position(Subterm,Term,Position), where Position is a list of argument positions identifying Subterm within Term. For example, the position of X in 2sin(X) is [2,1], since sin(X) is the second argument of the binary operator and X is the first argument of sin(X). (Hint: Add an extra argument for the subterm program, and build the position list top-down.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
