cl:nreverse   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/scheme.xtm

Implementation

;;;@ From: hugh@ear.mit.edu (Hugh Secker-Walker)
(define (cl:nreverse rev-it)
;;; Reverse order of elements of LIST by mutating cdrs.
  (cond ((null? rev-it) rev-it)
  ((not (list? rev-it))
   (slib:error "nreverse: Not a list in arg1" rev-it))
  (else (do ((reved '() rev-it)
       (rev-cdr (cdr rev-it) (cdr rev-cdr))
       (rev-it rev-it rev-cdr))
      ((begin (set-cdr! rev-it reved) (null? rev-cdr)) rev-it)))))
;@


Back to Index