reverse

Gamma: Version 4.0
Prev |  | Next

# `reverse`

`reverse` -- reverses the order of list elements.

## Syntax

    reverse (list)

## Arguments

`list`

  A list.

## Returns

A new list which whose top-level structure is the reverse of the input `list`. If the argument is not a list, returns the argument.

## Description

None of the elements of the original `list` is copied. The resulting list contains elements which are eq to the corresponding elements in the original. The original `list` is not changed.

## Example

        Gamma> S = list(1,2,3);
        (1 2 3)
        Gamma> R = reverse (S);
        (3 2 1)
        Gamma> S;
        (1 2 3)
        Gamma> car (S);
        1
        Gamma> caddr(R);
        1
        Gamma> eq (car (S),caddr(R));
        t
        Gamma>

Prev | Home | Next
`remove` | Up | `rplaca`, `rplacd`

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