These procedures are provided by all implementations.
identity returns its argument.
Example:(identity 3) ⇒ 3 (identity '(foo bar)) ⇒ (foo bar) (map identity lst) == (copy-list lst)
An exchanger is a procedure of one argument regulating mutually exclusive access to a resource. When a exchanger is called, its current content is returned, while being replaced by its argument in an atomic operation.
Returns a new exchanger with the argument obj as its initial content.(define queue (make-exchanger (list a)))
A queue implemented as an exchanger holding a list can be protected from reentrant execution thus:(define (pop queue) (let ((lst #f)) (dynamic-wind (lambda () (set! lst (queue #f))) (lambda () (and lst (not (null? lst)) (let ((ret (car lst))) (set! lst (cdr lst)) ret))) (lambda () (and lst (queue lst)))))) (pop queue) ⇒ a (pop queue) ⇒ #f
The following procedures were present in Scheme until R4RS (see Language changes). They are provided by all SLIB implementations.