dragonwasrobot / learn-prolog-now-exercises

My solutions to the exercises and practical sessions of the book 'Learn Prolog Now!' by Patrick Blackburn, Johan Bos, and Kristina Striegnitz.
288 stars 81 forks source link

Exercise 6.3.3 #40

Closed GlennVincentie closed 6 years ago

GlennVincentie commented 6 years ago

%% 3. Write a predicate final(X,List) which checks whether X is the last element %% of List.

final(X, List) :- append(, [X], List). should be final(X, List) :- append(, [_|X], List). to only check the last element of the list instead of the entire list being [X].