### 7.3 Selecting List Components

standard procedure: list? object ¶
SRFI 1 procedure: proper-list? object ¶

  Returns `#t` if object is a proper list, otherwise returns `#f`. By definition, all proper lists have finite length and are terminated by the empty list. If object is a circular list, returns `#f`.

  Any object satisfying this predicate will also satisfy exactly one of `pair?` or `null?`.

      (list? (list 'a 'b 'c))                 ⇒ #t
      (list? (cons* 'a 'b 'c))                error→
      (list? (circular-list 'a 'b 'c))        ⇒ #f

SRFI 1 procedure: circular-list? object ¶

  Returns `#t` if object is a circular list, otherwise returns `#f`.

      (circular-list? (list 'a 'b 'c))        ⇒ #f
      (circular-list? (cons* 'a 'b 'c))       ⇒ #f
      (circular-list? (circular-list 'a 'b 'c)) ⇒ #t

SRFI 1 procedure: dotted-list? object ¶

  Returns `#t` if object is an improper list, otherwise returns `#f`.

      (dotted-list? (list 'a 'b 'c))          ⇒ #f
      (dotted-list? (cons* 'a 'b 'c))         ⇒ #t
      (dotted-list? (circular-list 'a 'b 'c)) ⇒ #f

standard procedure: length list ¶

  Returns the length of list. Signals an error if list isn’t a proper list.

      (length (list 'a 'b 'c))                ⇒ 3
      (length (cons* 'a 'b 'c))               error→
      (length (circular-list 'a 'b 'c))       error→

SRFI 1 procedure: length+ clist ¶

  Clist must be a proper or circular list. If clist is a circular list, returns `#f`, otherwise returns the number of pairs comprising the list (which is the same as the length for a proper list).

      (length+ (list 'a 'b 'c))               ⇒ 3
      (length+ (cons* 'a 'b 'c))              error→
      (length+ (circular-list 'a 'b 'c))      ⇒ #f

procedure: count-pairs object ¶

  Counts the number of pairs in a list-like object. If object is a proper list, returns the same value as `length`. If object is a dotted list, returns the number of pairs including the last one. If object is a circular list, counts the number of pairs up to and including the one with the backwards link. If object is any other object, returns `0` as apropriate for an empty dotted list.

      (count-pairs (list 'a 'b 'c))           ⇒ 3
      (count-pairs (cons* 'a 'b 'c))          ⇒ 2
      (count-pairs (circular-list 'a 'b 'c))  ⇒ 3

standard procedure: null? object ¶

  Returns `#t` if object is the empty list; otherwise returns `#f`.

      (null? '())                             ⇒ #t
      (null? (list 'a 'b 'c))                 ⇒ #f
      (null? (cons* 'a 'b 'c))                ⇒ #f
      (null? (circular-list 'a 'b 'c))        ⇒ #f

SRFI 1 procedure: null-list? list ¶

  List is a proper or circular list. This procedure returns `#t` if the argument is the empty list `()`, and `#f` if the argument is a pair. It is an error to pass this procedure any other value. This procedure is recommended as the termination condition for list-processing procedures that are not defined on dotted lists.

standard procedure: list-ref list k ¶

  Returns the kth element of list, using zero-origin indexing. The valid indexes of a list are the exact non-negative integers less than the length of the list. The first element of a list has index `0`, the second has index `1`, and so on.

      (list-ref '(a b c d) 2)                 ⇒ c
      (list-ref '(a b c d)
                (exact (round 1.8)))
           ⇒ c

  `(list-ref list k)` is equivalent to `(car (drop list k))`.

SRFI 1 procedure: first list ¶
SRFI 1 procedure: second list ¶
SRFI 1 procedure: third list ¶
SRFI 1 procedure: fourth list ¶
SRFI 1 procedure: fifth list ¶
SRFI 1 procedure: sixth list ¶
SRFI 1 procedure: seventh list ¶
SRFI 1 procedure: eighth list ¶
SRFI 1 procedure: ninth list ¶
SRFI 1 procedure: tenth list ¶

  Returns the specified element of list. It is an error if list is not long enough to contain the specified element (for example, if the argument to `seventh` is a list that contains only six elements).