[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.5 Lists


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.5.1 car, cdr, cons, append, reverse, length

car(list)

:: The first element of the given non-null list list.

cdr(list)

:: A list obtained by removing the first element of the given non-null list list.

cons(obj,list)

:: A list obtained by adding an element obj to the top of the given list list.

append(list1,list2)

:: A list obtained by adding all elements in the list list2 according to the order as it is to the last element in the list list1.

reverse(list)

:: reversed list of list.

length(list|vect)

:: Number of elements in a list list and a vector vect.

return

car() : arbitrary, cdr(), cons(), append(), reverse() : list, length() : non-negative integer

list list1 list2

list

obj

arbitrary

[0] L = [[1,2,3],4,[5,6]];
[[1,2,3],4,[5,6]]
[1] car(L);
[1,2,3]
[2] cdr(L);
[4,[5,6]]
[3] cons(x*y,L);
[y*x,[1,2,3],4,[5,6]]
[4] append([a,b,c],[d]);
[a,b,c,d]
[5] reverse([a,b,c,d]);
[d,c,b,a]
[6] length(L);
3
[7] length(ltov(L));
3
[8] L[2][0];
5

[ << ] [ < ] [ Up ] [ > ] [ >> ]

This document was generated on October 21, 2017 using texi2html 5.0.