Advertisement
UrQuan

LISP03 Vjezbe

Oct 27th, 2015
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.97 KB | None | 0 0
  1. (progn
  2. (setq a (make-array '(3 3)))
  3. (setq broj 1)
  4.  
  5. (dolist (x '(0 1 2))
  6.     (dolist (y '(0 1 2))
  7.         (progn
  8.             (setf (aref a x y) broj)
  9.             (setq broj (+ broj 1))
  10.         )
  11.     )
  12. )
  13. a
  14. )
  15.  
  16. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  17.  
  18. (defstruct student
  19. ime
  20. prezime
  21. ocjena)
  22. (setq studenti (list))
  23. (push studenti (make-student :ime "Ante" :prezime "Antic" :ocjena 5))
  24. (make-student :ime "Mate" :prezime "Matic" :ocjena 5)
  25. (make-student :ime "Ivan" :prezime "Ivic")
  26.  
  27. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  28.  
  29. (defstruct student
  30. ime
  31. prezime
  32. ocjena)
  33. (setq studenti (list))
  34. (push (make-student :ime "Ante" :prezime "Antic" :ocjena 5) studenti)
  35. (push (make-student :ime "Mate" :prezime "Matic" :ocjena 5) studenti)
  36. (push (make-student :ime "Ivan" :prezime "Ivic") studenti)
  37.  
  38. (setf (student-ocjena (car studenti)) 5)
  39.  
  40. studenti
  41.  
  42. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  43.  
  44. ; NE RADI, POPRAVI
  45.  
  46. (defun duljina (x &optional duljinaliste=0)
  47.     (if (eq (cdr x) nil) duljinaliste)
  48.     (duljina (cdr x) 7)
  49. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement