[Solved] 21 Write Prolog Rule Getlast L E Return Last Element List L E 5 Test Case Getlast B C X Y Q37167334
2.1
Write a Prolog rule: get_last(L, E), which return the lastelement of list L to E.
[5]
Test case: |?- get_last([a, b, c, x, y], E)
It returns E = y
2.2
Write a Prolog rule: remove_last(L, Ls), which return thesub-list without the last element
to Ls.
[10]
Test case: |?- remove_last([a, b, c, x, y], Ls)
It returns Ls = [a, b, c, x]
Expert Answer
Answer to 2.1 Write a Prolog rule: get_last(L, E), which return the last element of list L to E. [5] Test case: |?- get_last([a, b… . . .
OR

