Expressions, Types, and Functions
- slide 21 : 46
List functions
There exists a number of important List functions in Scheme, and we often write other such functions ourselves
(null? lst)
A predicate that returns whether lst is empty
(list? lst)
A predicate that returns whether lst is a proper list
(length lst)
Returns the number of elements in the proper list lst
(append lst1 lst2)
Concatenates the elements of two or more lists
(reverse lst)
Returns the elements in lst in reverse order
(list-ref lst k)
Accesses element number k of the list lst
(list-tail lst k)
Returns the k'th tail of the list lst
R5RS: Pairs and Lists
List functions in the general LAML library