Answer to Question #111074 in Prolog for lk

Question #111074
1. Write a predicate (first_middle_last/4) to find the first, middle, and last elements of a list. Some built-in predicates that may help you: nth0/3 (this is written as nth/3 in the above link, but it should actually be nth0/3), length/2, div/2 (performs integer division). You may use any built-in predicates you like. There is a section on List Processing that you might find helpful. After implementing your predicate, please run the following tests and include the answers in your pdf submission (screenshots might work best).
a. first_middle_last ([1,2,3], First, Middle, Last).
b. first_middle_last ([1,2,3,4,5], First, Middle, Last).
c. first_middle_last ([19,25,72,9,4,15,23,19,32,41,53], First, Middle, Last).
1
Expert's answer
2020-04-24T11:32:32-0400
Dear lk, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS