reverse   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/tests/core/algebraic_data_types.xtm

Implementation

;; tail recursive version
(bind-func reverse:[ADList{!a}*,ADList{!a}*]*
  (lambda (lst)
    (let ((rev (lambda (old new)
                 (if (ADNil$ lst () #t #f)
                     rlst
                     (rev (ADCons$ old (x xs) xs (ADNil))
                          (ADCons$ old (x xs)
                                    (ADCons x new)
                                    (ADNil)))))))
      (rev lst (ADNil)))))


Back to Index

Similar Entries

  • cl:nreverse    scheme
  • impc:ti:reverse-set-bangs-from-reified    scheme
  • reverse    xtlang
  • reverse    xtlang
  • reverse    xtlang
  • reverse_inline    xtlang
  • reverse_r    xtlang