;; | ---------------------------------------------------------------------------- ;; | LI_MovList ;; | ---------------------------------------------------------------------------- ;; | Function : Moves an element within a list ;; | Argument : 'Lst' - List to edit ;; | 'Idx' - Element index to move ;; | 'MvAmt' - Number of positions to move ;; | Return : ;; | Update : October 1, 2008 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun LI_MovList ( Lst Idx MvAmt / len newIdx oldItm newItm ) (setq len (length Lst) newIdx (+ Idx MvAmt) ) (if (< newIdx 1) (setq newIdx 1) ) (if (> newIdx len) (setq newIdx len) ) (setq oldItm (nth (1- Idx) Lst) newItm (nth (1- newIdx) Lst) Lst (LI_RepList Lst Idx newItm) Lst (LI_RepList Lst newIdx oldItm) ) )