I wonder how I can print in LISP every new value from the "for" loop in a new list, which it creates each time by calling a function.
I created func:
(defun make (id name surname) (list :id id :name name :surname surname) )
Here I created a global variable:
(defvar *db* nil)
And here I defined func to add each new value to save it in db:
(defun add (cd) (push cd *db*))
So, I can add all the new data in db, for example:
(add (make 0 "Oleg" "Orlov" ) )
To see the contents of my db, I can use:
*db*
So, I am wondering how to put each new list of records in db using the "for" loop, I print the values ββin the "for" loop in LISP as follows:
(loop for i from 1 to 10 do ( ... ))
If, I use:
(loop for i from 0 to 10 do (add (make i "Oleg" "Orlov") ) )
If you read db using *db* , you will see that all evelen entries have been added, but after calling the last line you will get a NIL result in response.
Why do I catch the result of NIL, not T, and what does it mean?
Thanks, Regards!
user1131997
source share