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

9.18.1 Fundamental sequence accessors

Generic function: ref (seq <sequence>) index &optional fallback
Returns index-th element of the sequence seq. This method enables uniform access for any sequence types.

When index is less than zero, or greater than or equal to the size of the sequence, fallback is returned if provided, or an error is signalled if not.

 
(ref '(a b c) 1)  => b
(ref '#(a b c) 1) => b
(ref "abc" 1)     => #\b

Generic function: (setter ref) (seq <sequence>) index value
Sets value to the index-th element of the sequence seq. This is the uniform sequence modifier.

 
(let ((x (list 'a 'b 'c)))
  (set! (ref x 1) 'z)
  x) => (a z c)

(let ((x (vector 'a 'b 'c)))
  (set! (ref x 1) 'z)
  x) => #(a z c)

(let ((x (string #\a #\b #\c)))
  (set! (ref x 1) #\z)
  x) => "azc"

Generic function: referencer (seq <sequence>)

Generic function: modifier (seq <sequence>)



This document was generated by Ken Dickey on November, 28 2002 using texi2html