tests whether a term is member of a list....
Move to
=> <=
Darueber Spitze
See also
append/3
member/2
reverse/2/3
sort/2
merge_sort/2
IF Computer > MINERVA > Manual > Reference > Predicates > Lists > member/2

member/2

tests whether a term is member of a list.

member(?Term, ?List)

member/2 declares, that Term is a member of List. Different cases can be:

  • If Term and List are not variables then member/2 tests whether Term is member of List. By backtracking member/2 succeeds as often as Term is member of List.
  • If Term is a variable and List is bound to a list then member/2 retrieves (by backtracking) all elements of List and unifies them with Term.

  • If Term is not a variable and List is an open list (i.e. the tail of the list is a variable) then member/2 asserts that Term is a member of List.

Arguments

Term                   term
List                   list 

Examples

member(b,[a,b,c]). Succeeds.
member(X,[a,b]). Succeeds twice with substitution
X <- a
X <- b
member(a,X). Succeeds infinitely with substitution
X <- [a|_1],
X <- [_2,a|_3],
X <- [_4,_5,a|_6],....
member(X,Y). Succeeds infinitely with substitution
X <- _1, Y <- [_1|_2],
X <- _3, Y <- [_4,_3|_5],
X <- _6, Y <- [_7,_8,_6|_9], ...

Standard

This predicate is not part of the ISO-Prolog Standard.

See also

append/3, reverse/2/3, sort/2. merge_sort/2.

read on...
MINERVA
ifcomputer logo
f
Expert Services on the Web
Sprache
English
Japanese
Server
USA
Japan
Site Access
Local Index
Local Contents
Site Contents
Site Index
Printer Friendly
For imode
For PDA
Search
document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/lists/member/home_de.html
published 2008/10/13 update 2001/2/7 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
scroll to top managed with ubiCMS