Determine the largest number from a list of numbers (first parameter), the maximum 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 last/2 lengthlist/2 member/2 prefix/2 reverse/2 smallest_number/2 sublist/2 suffix/2 sum_list/2 sum_list_integer/2
| Example | |
| largest_number([], A). | succeeds but the variable A is not unified with a value
because the list is empty A=__1 |
| largest_number([1, 2], A). | succeeds and A is unified with the value 2 A=2 |
| largest_number([1, 2], 2.1). | fails because 2 is the maximum of the list and that value cannot be unified with the value 2.1 |