XLISP reverse

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# reverse

Type: | - | function (subr)
Source: | - | xllist.c

## Syntax

(reverse list-expr)
  list-expr - a list or list expression
  returns - a new list in the reverse order

## Description

The 'reverse' function reverses the 'list-expr'. The reversed list is the returned value. The reversal process only occurs on the 'top-level' of the 'list-expr'. If there are nested sub-lists, these are left intact.

## Examples

    (reverse NIL)                     ; returns NIL
    (reverse 'a)                      ; error: bad argument type
    (reverse '(a))                    ; returns (A)
    (reverse '(a b c))                ; returns (C B A)
    (reverse '((a b) (c d) (e f)))    ; returns ((E F) (C D) (A B))
    (reverse (list (+ 1 2) (+ 3 4)))  ; returns (7 3)

See the reverse function in the XLISP 2.0 manual.

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference