====== List smallest element ====== {{tag>lists cut}} ===== Description ===== Finding least lemenet from list **Source**: PROLOG str. 196 Wydawnictwo PLJ Warszawa 1991 ISBN 83-85190-63-5 ===== Download ===== Program source code: {{list_smallest_element.pl}} ===== Listing ===== min([H|[]], H). min([H|T], Minimum) :- min(T, M1), mn(H, M1, Minimum), !. mn(X, Y, X) :- X < Y. mn(X, Y, Y) :- X >= Y. test :- min([4, 6, 3, 2, 8], M). ===== Comments =====