Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #EX_LAB9:
- > (setq m (make-array '(3 2)))
- #2A((NIL NIL) (NIL NIL) (NIL NIL))
- > (setf (aref m 0 0) 1)
- > (setf (aref m 0 1) 2)
- > (setf (aref m 1 0) 3)
- > (setf (aref m 1 1) 4)
- > (setf (aref m 2 0) 5)
- > (setf (aref m 2 1) 6)
- #2A((1 2) (3 4) (5 6))
- _______[#EX_1]_______:
- (defmacro dotimes (variable iterator result body)
- `(do ((, variable 0 (+, variable 1)))
- ((=, variable, iterator), result), body)
- )
- (defun sum (matrice)
- (let((sum 0))
- (dotimes i(array-dimension matrice 0)
- sum(dotimes j (array-dimension matrice 1))
- 'd (setq sum (+ (aref matrice i j) sum))
- )
- )
- )
- > (suma m)
- 21
- _______[#EX_2]_______:
- (defun show (mtr)
- (dotimes i (array-dimension mtr 0)
- 'NIL (dotimes j (array-dimension mtr 1)
- (format 't "\n")
- (format 't "~A " (aref m i j))
- )
- )
- )
- _______[#EX_3]_______:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement