DarkDevourer

Funk

May 13th, 2021
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. (setf (get 'car 'model) 'ford
  2. (get 'car 'motor) 'engine
  3. (get 'engine 'horse_power) 340
  4. (get 'engine 'cylinders) 8
  5. (get 'car 'seats) 4
  6. (get 'car 'wheels) 4
  7. (get 'car 'trunk) 'trunk
  8. (get 'trunk 'capacity) 50
  9. (get 'trunk 'content) nil
  10. )
  11. NIL
  12.  
  13. (defun put_in_trunk (L)
  14. (cond ((eql (get 'trunk 'content) NIL) (setf (get 'trunk 'content) L))
  15. (T (setf (get 'trunk 'content) (append (get 'trunk 'content) L)))
  16. )
  17. )
  18.  
  19. PUT_IN_TRUNK
  20.  
  21. (get 'trunk 'content)
  22. NIL
  23.  
  24. (defun get_from_trunk (item)
  25. (cond ((null item) nil)
  26. ((null (get 'trunk 'content)) nil)
  27. (T (mapcar (lambda (i)
  28. (cond ((null i) nil)
  29. ((null (member i (get 'trunk 'content))) nil)
  30. (T (setf (get 'trunk 'content) (delete i (get 'trunk 'content))))
  31. ))
  32. item))
  33. )
  34. )
  35. GET_FROM_TRUNK
  36.  
  37.  
  38. (defun change_car_model (N)
  39. (cond ((> (length N) 1) nil)
  40. ((null n) nil)
  41. (T (setf (get 'car 'model) (car N)))
  42. )
  43. )
  44. CHANGE_CAR_MODEL
  45.  
  46. (defun change_horse_power (x)
  47. (cond ((numberp x)
  48. (cond ((> x 0) (setf (get 'engine 'horse_power) x))
  49. (T nil)))
  50. (T nil)
  51. )
  52. )
  53. CHANGE_HORSE_POWER
  54.  
  55. (defun change_cylinders_number (x)
  56. (cond ((numberp x)
  57. (cond ((> x 0) (setf (get 'engine 'cylinders) x))
  58. (T nil)))
  59. (T nil)
  60. )
  61. )
  62. CHANGE_CYLINDERS_NUMBER
  63.  
  64. (defun change_seats_number (x)
  65. (cond ((numberp x)
  66. (cond ((> x 0) (setf (get 'engine 'seats) x))
  67. (T nil)))
  68. (T nil)
  69. )
  70. )
  71. CHANGE_SEATS_NUMBER
  72.  
  73. (defun change_wheels_number (x)
  74. (cond ((numberp x)
  75. (cond ((> x 0) (setf (get 'engine 'wheels) x))
  76. (T nil)))
  77. (T nil)
  78. )
  79. )
  80. CHANGE_WHEELS_NUMBER
  81.  
Advertisement
Add Comment
Please, Sign In to add comment