member(+Element, ?List)
member(?Element, +List)

Determine if an element (first parameter) is a member of a list (second parameter). If the first parameter is a variable and the second parameter is a list then member/2 will give the next element of the list per call to member/2, see the last example of member/2.

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 prefix/2 reverse/2 smallest_number/2 sublist/2 suffix/2 sum_list/2 sum_list_integer/2

Example
member(a, [b, c]). fails because the element a is not in the list [b,c]
member(c, [b, c]). succeeds because the element c is in the list [b, c]
member(A, [b, c]). succeeds and two solutions are produced:
A=b

A=c

 

 

info@trinc-prolog.com