intersection

Gamma: Version 4.0
Prev |  | Next

# `intersection`

`intersection` -- constructs a list of all the elements found in both of two lists.

## Syntax

    intersection (listA, listB)

## Arguments

`listA`

  A list.

`listB`

  A list.

## Returns

All elements which appear in both `listA` and `listB`.

## Description

This function generates a new list which contains all of the elements that appear in both `listA` and `listB`. The elements are compared using eq. The order of the elements in the resulting list is not defined.

## Example

        Gamma> A = list(#a,#b,#c);
        (a b c)
        Gamma> B = list(#b,#c,#d);
        (b c d)
        Gamma> intersection(A,B);
        (b c)
        Gamma>

## See Also

`eq, equal` `difference` `union`

Prev | Home | Next
`insert` | Up | `length`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.