[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

#### 2.7.11.2 Member

Another built in predicate function has the virtual code shown below.

T20

  [[`member`]] = `((nil,nil),((nil,nil),nil))`

As the mnemonic suggests, the function implemented by this code detects whether a given item is a member of a list. The left side of its argument is the item to be detected, and the right side is the list that may or may not contain it. Lists are represented as explained in Representation of Numeric and Textual Data.

The virtual code semantics can be specified by these three properties of the operator.

P19

  [[`member`]] `(x,nil)` = `nil`

P20

  [[`member`]] `(x,(x,y))` = `(nil,nil)`

P21

  For distinct trees `x` and `y`, [[`member`]] `(x,(y,z))` = [[`member`]] `(x,`z`)`

As in the case of `compare`, the implementation of `member` is well optimized in C, so this form is to be preferred over an ad hoc construction of a membership testing function in virtual code.

This document was generated on November 8, 2012 using texi2html 1.82.