Advertisement
gjorgjikirkov

rotiraj-K-L-Matrica

Jun 11th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.48 KB | None | 0 0
  1. (defun rotiraj-K-L-Matrica (k M)
  2.     (cond
  3.         ((null M) nil)
  4.         (t (cons (rotiraj k (car M)) (rotiraj-K-L-Matrica k (cdr M))))
  5.     )
  6.    
  7. )
  8.  
  9. (defun rotiraj (k L)
  10.     (cond
  11.         ((eq k 0) L)
  12.         (t (rotiraj (- k 1) (append (cdr L) (list (car L)))))
  13.     )  
  14. )
  15.  
  16.  
  17.  
  18. (print (rotiraj-K-L-Matrica 5 '((7 8 b 3 a 4)(3 8 a b)(b a 3 0)))) ;; ((4 7 8 B 3 A) (8 A B 3) (A 3 0 B))
  19. (print (rotiraj-K-L-Matrica 3 '((b 3 a 4)(3 8 a b)(b a 3 0)))) ;; ((4 b 3 a)(b 3 8 a)(0 b a 3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement