Learn R Programming

rgp (version 0.4-1)

first: Functions for Lisp-like list processing

Description

Simple wrapper functions that allow Lisp-like list processing in R: first to fifth return the first to fifth element of the list x. rest returns all but the first element of the list x. is.empty returns TRUE iff the list x is of length 0. is.atom returns TRUE iff the list x is of length 1. is.composite returns TRUE iff the list x is of length > 1. contains return TRUE iff the list x contains an element identical to elt.

Usage

first(x)
rest(x)
second(x)
third(x)
fourth(x)
fifth(x)
is.empty(x)
is.atom(x)
is.composite(x)
contains(x, elt)

Arguments

x
A list or vector.
elt
An element of a list or vector.