Page 1 of 1

Q 10. Write a prolog procedure every-other/2 that receives a source list as its first argu- ment and produces a list in

Posted: Mon Jun 06, 2022 12:12 pm
by answerhappygod
Q 10 Write A Prolog Procedure Every Other 2 That Receives A Source List As Its First Argu Ment And Produces A List In 1
Q 10 Write A Prolog Procedure Every Other 2 That Receives A Source List As Its First Argu Ment And Produces A List In 1 (46.52 KiB) Viewed 48 times
prolog please
Q 10. Write a prolog procedure every-other/2 that receives a source list as its first argu- ment and produces a list in the second argument whose elements are the elements of odd indexes in the source list. Examples are given in the following: ?- every-other ([], L) L = []. ?- every-other ([1], L) L = [1]. ?- every-other ([1, 2], L) L = [1]. ?- every-other ([1, 2, 3], L) L = [1, 3]. ?- every-other ([1, 2, 3, 4], L) L = [1, 3]. Make sure your procedure is efficiently terminated.