Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Getting Average of Numbers using LISP

(setf x (make-array '(3 3) 
   :initial-contents '((1 2 3 ) (4 5 6) (7 8 9)))
)
(write x)

(defun afisare (i j)
(print (aref x i j))
)

(afisare 0 1)

(setq a (make-array '(2 2):displaced-to x :displaced-index-offset 5 ))
(write a)


(setf (get 'student 'age) 43)
(setf (get 'student 'cnp) '123456789)
(setf (get 'student 'anstudiu) 3)
(setf (get 'student 'ioan)  1)

(terpri)
(write (symbol-plist 'student))


(defun avrege()
(terpri)
(princ "Enter number 1: ")
(setq x (read))
(write x)
(princ "enter number 2")

(setq y (read))
(write y)
(princ "enter number 3")

(setq z (read))
(write z)
(setq avrege (/ (+ x y z) 3))
(princ "avrege: ")
(write avrege)
)

(avrege)

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.