70 likes | 206 Views
This text explores the use of variables and functions in Lisp programming, highlighting key concepts such as global and local variables, function definitions, and the manipulation of data. It presents examples of defining parameters, incrementing variables, and utilizing printing functions to display results. The text also demonstrates how to use conditional and list functions to manage data structures effectively, providing insights into the syntax and structure of Lisp code. The reader will gain a foundational understanding of how to work with variables and functions in Lisp.
E N D
Premenné • (defparameter a) • (defparameter a 10 "Globalna premenna a") • (defvar b) • (defvar b 7 "Globalna premenna b") • (defvar b 12) • (defun a+ () "pristup k premennej a" (incf a) a)
Premenné • (defun c? (c) c) • (c? 9) • c • (let ((c 3) (d)) (setf d (+ c 1)) (list c d)) • c • (let* ((c 3) (d (+ c 1))) (list c d))
Premenné • (defun c? (c) (print c)) • (let ((c 3)) (print c) (let ((c 5)) (print c) (print (c? 7)) (print c)) (print c))
Premenné • (defparameter c 2) • (defun c? () (print c)) • (let ((c 3)) (print c) (let ((c 5)) (print c) (print (c?)) (print c)) (print c))
Premenné • a • (let () (print a)) • (let ((a 2)) (print a)) • a
Premenné • (setf z 9) • z • (let ((x 2)) (setf y 8)) • y
Premenné • (setf c! (let ((pocet 2)) #'(lambda () pocet))) • (funcall c!)