• API
• FAQ
• Tools
• Archive
A Pastebin account makes a great Christmas gift
SHARE
TWEET

# Untitled

a guest Mar 13th, 2018 51 Never
ENDING IN00days00hours00mins00secs

1. (print "Problema 1")
2.
3. (defun my-first (lst)
4.     (print (CAR lst)))
5. (my-first'(A B C))
6.
7. (defun my-last(lst)
8.     (print (CDR lst)))
9. (my-last'(A B C))
10.
11. (defun my-third (lst)
12.     (print (CAR(CDR(CDR lst)))))
13. (my-third'(A B C D E F))
14.
15. (defun construct (lst lst1)
16.     (print (CONS lst lst1)))
17. (construct 'A '(C D))
18.
19. (print "Problema 2")
20.
21. (defun rotate-left (lst)
22.     (print(APPEND (CDR lst) (list(CAR lst)))))
23. (rotate-left '(A B C))
24. (rotate-left (rotate-left'(A B C)))
25.
26. (print "Problema 3")
27.
28. (defun rotate-right (lst)
29.     (print(APPEND (LAST lst) (REVERSE(CDR(REVERSE lst))))))
30. (rotate-right '(A B C D))
31.
32. (print "Problema 4")
33.
34. (defun palindrom (lst)
35.     (print(APPEND lst (REVERSE lst))))
36. (palindrom'(A B C D))
37.
38. (print "Problema 5")
39.
40. (defun delta (a b c)
41.     (- (* b b) (* a c 4)))
42.
43. (defun rez (a b c)
44.     (print (COND(( > (delta a b c) 0)
45.                  (LIST (/ (+ (- b) (sqrt (delta a b c))) (* 2 a)) (/ (- (- b) (sqrt (delta a b c))) (* 2 a))))
46.                 (nil)
47.                 ((= (delta a b c) 0)
48.                  (LIST (/ (- b) (* 2 a)))))))
49. (rez 1 -4 4)
50.
51. (print "Problema 6")
52.
53. (defun evenpp (a)
54.     (print(ZEROP (REM a 2))))
55. (evenpp 2)
56. (evenpp 3)
57.
58. (print "Problema 7")
59.
60. (defun palindromp (lst)
61.     (print (EQUAL lst (REVERSE lst))))
62. (palindromp '(A B A))
63. (palindromp '(A B A C))
64.
65. (print "Problema 8")
66.
67. (defun not-realp (a b c)
68.     (print(MINUSP (- (* b b) (* a c 4)))))
69. (not-realp 1 3 1)
70.
71. (print "Problema 9")
72.
73. (defun absp (x)
74.     (print(COND((MINUSP x) (* x -1))
75.                ((> x 0) x))))
76. (absp -4)
77.
78. (defun minim (a b)
79.     (print(COND((< a b) a)
80.                ((> a b) b))))
81. (minim 1 5)
82.
83. (defun maxim (a b)
84.     (print(COND((< a b) b)
85.                ((> a b) a))))
86. (maxim 1 5)
87.
88. (print "Problema 10")
89.
90. (defun notp (a)
91.     (print(COND((NULL a) 't)
92.                (a nil))))
93. (notp 2)
94. (notp nil)
95.
96. (defun andp(a b c)
97.     (print(COND ((equal a nil) nil)
98.           ((equal b nil) nil)
99.           ((equal c nil) nil)
100.           (c))))
101.
102. (defun orp(a b c)
103.     (print(COND ((NOT (equal a nil)) a)
104.           ((NOT (equal b nil)) b)
105.           ((NOT (equal c nil)) c)
106.           (nil))))
107.
108. (print "Problema 11")
109.
110. (print(CDR nil))
111. (print(CAR nil))
112. (print(cons nil nil))
113. (print(cons (car nil) (cdr nil)))
114.
115. (print "Problema 12")
116.
117. (defun med(a b c)
118.     (cond ((or (and (equal c (min a b c)) (equal a (max a b c))) (and (equal a (min a b c)) (equal c (max a b c)))) b)
119.           ((or (and (equal b (min a b c)) (equal c (max a b c))) (and (equal c (min a b c)) (equal b (max a b c)))) a)
120.           ((or (and (equal a (min a b c)) (equal b (max a b c))) (and (equal b (min a b c)) (equal a (max a b c)))) c)
121.     ))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top