list-access: List/vector access functions

Description Usage Arguments Details Value

Description

These functions are accessors for various elements and subsequences of lists and vectors. They are written in a type-generic way and will work for any broadly defined sequence type: vectors, lists (aka "generic vectors") and pairlists.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
car(x)

cdr(x)

first(x)

last(x)

caar(x)

cadr(x)

cdar(x)

cddr(x)

caaar(x)

caadr(x)

cadar(x)

caddr(x)

cdaar(x)

cdadr(x)

cddar(x)

cdddr(x)

caaaar(x)

caaadr(x)

caadar(x)

caaddr(x)

cadaar(x)

cadadr(x)

caddar(x)

cadddr(x)

cdaaar(x)

cdaadr(x)

cdadar(x)

cdaddr(x)

cddaar(x)

cddadr(x)

cdddar(x)

cddddr(x)

Arguments

x

The object whose elements or subsequences to access.

Details

Using "sequence" to mean list, other vector or pairlist, the basic functions here are

There are also a large number of functions of the form cXXXXr, where there are two, three or four "a"'s or "d"'s between the c and r. These functions are compositions of car and cdr: to give one example, caadr(x) is equivalent to car(car(cdr(x))). All such functions with up to four letters between the c and the r are pre-defined here.

Value

A particular element or subsequence.


wwbrannon/schemeR documentation built on May 4, 2019, 12:03 p.m.