rotate   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/adt.xtm

Implementation

(bind-func rotate:[List{!a}*,List{!a}*,i64]*
  (lambda (l n)
    (if (< n 0)
        (append (drop l (* -1 n)) (take l (* -1 n)))
        (append (drop l (- (length l) n))
                (take l (- (length l) n))))))


Back to Index

Similar Entries