reverse   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/contrib/algebraic_data_types.xtm

Implementation

(bind-func reverse:[List{!a}*,List{!a}*]*
  (lambda (lst)
    (let ((rev (lambda (old new)
                 (if (Nil$ lst () #t #f)
                     rlst
                     (rev (Cons$ old (x xs) xs (Nil))
                          (Cons$ old (x xs)
                                 (Cons x new)
                                 (Nil)))))))
      (rev lst (Nil)))))


Back to Index

Similar Entries