本帖最后由 byghbcx 于 2011-11-14 21:12 编辑
- (defun tt (n lst)
- (setq lst_r (reverse lst) lt lst)
- (repeat n (setq lt (cdr lt)))
- (repeat (- (length lst_r) (- n 1)) (setq lst_r (cdr lst_r)))
- (setq lst_r (reverse lst_r))
- (append lst_r lt)
- )
- (defun tt( n lst / t1 t2 m temp)
- (setq m 0 temp '())
- (mapcar '(lambda(x) (setq m (1+ m)) (if (= n m) t (setq temp (cons x temp )))) lst)
- (reverse temp)
- )
- (defun tt (n lst)
- (setq lst_r (reverse lst) lt lst nn (nth (1- n) lst))
- (while (/= (length lt) (- (length lst) n))
- (setq lt (cdr (member nn lt))))
- (while (/= (length lst_r) (1- n))
- (setq lst_r (cdr (member nn lst_r))))
- (append (reverse lst_r) lt)
- )
我用了几种方法,用MEMBER还是较快 |