Determine the smallest number from a list of numbers (first parameter), the minimum is unified with the second parameter.
This predicate is located in the file 'list.txt', use ensure_loaded/1 to include this file.
see also: conc/3 del/3 largest_number/2 last/2 lengthlist/2 member/2 prefix/2 reverse/2 sublist/2 suffix/2 sum_list/2 sum_list_integer/2
| Example | |
| smallest_number([], A). | succeeds but the variable A is not unified with a value
because the list is empty A=__1 |
| smallest_number([-1, 2], A). | succeeds and A is unified with the value -1 A= - 1 |
| smallest_number([1, 2], 2.1). | fails because 1 is the minimum of the list and that value cannot be unified with the value 2.1 |