This is a prolog question. PLEASE ANSWER IT WITH PROLOG LANGUAGE. Write a predic
ID: 3701048 • Letter: T
Question
This is a prolog question. PLEASE ANSWER IT WITH PROLOG LANGUAGE.
Write a predicate chop_up(List, NewList) that takes List and binds NewList to List with all sequences ofsuccessive increasing whole numbers replaced by a two-item list containing only the first and last number in the sequence. An example of successive increasing whole numbers is: 19,20,21,22. (Note that the numbers have to be successive in the sense of increasing by exactly 1 at each step.) For example:
In this example, the sequence 9,10 has been replaced by [9,10], the sequence 5,6,7 has been replaced by [5, 7], and 2,3,4 has been replaced by [2, 4].
Explanation / Answer
the sequence 5,6,7 has been replaced by [5, 7], and 2,3,4 has been replaced by [2, 4].
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.