remq, remv, remove, remp - remove elements from a list

LIBRARY

(import (rnrs))                     ;R6RS
(import (rnrs lists))               ;R6RS

SYNOPSIS

(remq obj list)
(remv obj list)
(remove obj list)
(remp proc list)

DESCRIPTION

Each of these procedures returns a list of the elements of list that do not satisfy a given condition.

The remp procedure applies proc to each element of list and returns a list of the elements of list for which proc returned #f. The other procedures return a list of the elements that are not obj.

The remq procedure uses eq?(3scm) to compare obj with the elements of list, while remv uses eqv?(3scm) and remove uses equal?(3scm).

The elements of the result list are in the same order as they appear in the input list. If multiple returns occur, the return values returned by earlier returns are not mutated.

Proc should accept one argument and return a single value. Proc should not mutate list. Proc is always called in the same dynamic environment as this procedure itself.

IMPLEMENTATION NOTES

The implementation must check the restrictions on proc to the extent performed by applying it as described above. An implementation may check whether proc is an appropriate argument before applying it.

RETURN VALUES

These procedures return a single value; a list.

EXAMPLES

(remp even? '(3 1 4 1 5 9 2 6 5))
        =>  (3 1 1 5 9 5)

(remove 1 '(3 1 4 1 5 9 2 6 5))
        =>  (3 4 5 9 2 6 5)

(remv 1 '(3 1 4 1 5 9 2 6 5))
        =>  (3 4 5 9 2 6 5)

(remq 'foo '(bar foo baz))
        =>  (bar baz)

COMPATIBILITY

These procedures are unique to R6RS.

ERRORS

This procedure can raise exceptions with the following condition types:
&assertion (R6RS)
The wrong number of arguments was passed or an argument was outside its domain.

SEE ALSO

filter(3scm)

STANDARDS

R6RS

HISTORY

These procedures first appeared in R6RS.

AUTHORS

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.


Markup created by unroff 1.0sc,    March 04, 2023.