Advertisement
Latkoski

Ротација на матрица на десно (butlast)

Aug 18th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.36 KB | None | 0 0
  1. (defun rotiraj (matrica k)
  2.     (cond
  3.         ((null matrica) nil)
  4.         (t (cons (pomosna (car matrica) k)(rotiraj (cdr matrica) k)))
  5.         )
  6.     )
  7.  
  8. (defun pomosna (matrica k)
  9.     (cond
  10.      ((= k 0) matrica)
  11.      (t (pomosna (cons (car (reverse matrica))(butlast matrica))(- k 1))))
  12.     )
  13.  
  14.    
  15. (print (rotiraj '((b 3 a 4)(3 8 a b)(b a 3 0)) 3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement