Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 6 [ 1 5 ] Let L 1 , L 2 and L denote lists of terms. Write Prolog programs to realise the following:
Question
Let L L and L denote lists of terms. Write Prolog programs to realise the following:
Note that the lengths of lists L and L should be equal in all cases:
a Interleave alternate elements of L and L into L
For example, if Labc and L
then L abc
Are the inputoutput roles of variables in your program reversible?
b Transpose L and L into L That is if Labc and L then
L abc
Are the inputoutput roles of your variables reversible?
c Suppose that L and L are lists of numeric values. Write a procedure
innerprodLLX that defines X to be the innerproduct of the two vectors L
and L
The innerproduct X is calculated as follows:
If we have two vectors a a an and b b bn then
X atimes b atimes b antimes bn
Are the inputoutput roles of the variable in your program reversible?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started