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

Function to take average of numbers using LISP

(print"Lucrarea 3")
(terpri)

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

(defun afisare(i j)
(print (aref a i j)))
(afisare 1 2)
(terpri)


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


(setf (get 'Student'nume) 'Mihai)
(setf (get 'Student'varsta)30)
(setf (get 'Student'AnStudiu)3)
(setf (get 'Student'CNP)18403123456)
(write (symbol-plist 'Student))
(terpri)


(defun averagesum(n1 n2 n3 n4 n5 n6 n7 n8 n9)
(/(+ n1 n2 n3 n4 n5 n6 n7 n8 n9)9))
(write(averagesum 5 6 7 5  5 4 7 8 9))

Advertisements
Loading...

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