nremove

Gamma: Version 4.0
Prev |  | Next

# `nremove`

`nremove` -- removes list items, destructively altering the list.

## Syntax

    nremove (s_exp, list, use_equal?)

## Arguments

`s_exp`

  Any Gamma or Lisp expression.

`list`

  A list.

`use_equal`

  If non-nil, use equal instead of eq for comparison.

## Returns

The `list` with any elements which are eq (or equal if specified) to `s_exp` destructively removed.

## Description

This function removes all occurrences of the `s_exp` within the given list and destructively alters the list to reduce its size by one for each occurrence. The default comparison used is eq. If the first argument is removed, then the return value will be (cdr list) with all other occurrences of `s_exp` destructively removed.

## Example

        Gamma> y = list (#a, #b, #c);
        (a b c)
        Gamma> nremove (#b, y);
        (a c)

        Gamma> x = list(1,2,3,4,5,6);
        (1 2 3 4 5 6)
        Gamma> nremove(3, x);
        (1 2 3 4 5 6)
        Gamma> nremove(3, x, t);
        (1 2 4 5 6)

        Gamma> y = list(1,2,3,4,1,2,3,4,1,2);
        (1 2 3 4 1 2 3 4 1 2)
        Gamma> nremove (1,y,t);
        (2 3 4 2 3 4 2)
        Gamma>

See the Handling Terminated Processes section of Common Functions for Any Program chapter in the Cogent Tools Demo and Tutorials book for an example of this function used in context.

## See Also

`nreplace`, `remove`

Prev | Home | Next
`nappend` | Up | `nreplace`, `nreplace_equal`

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