• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

create list

  • Thread starter Thread starter mkb
  • Start date Start date

mkb

Guest
Hello.
I am trying to create a program in lisp where I need to create a number of lists that depends on user input,
we say for simplicity that the program must ask how many classes of 10 pupils has a teacher, and for each class it puts in the names of the pupils in a special list
My code that I carry under turns but does not do what I want, does not create a set of lists
Namely
Name
Namelist3
....
in which it inserts the names of the students but simply a single name list
Name

Here is the code
(defunc c:class()
(setq nclassi(getint "invents the number of classes : ")))
(setq cont)

(repeat nclasses)
(setq n(itoa cont))
(setq nomelist(strcat "nomelista" n)
(namelist print)
(setq namelist(list ))
(repeat 10)
(seq nallievo(list (getstring "study name: ")))))
(Sectq Namelist(Nallievo Namelist Append))
)
(namelist print)
(setq cont(+ cont 1))

); end repeat
); end deceased


thanks to all
mk
 
(defunc c:classes ()
(setq nclasses (getint " enter the number of classes : ")
cont 1
)
(repeat nclasses)
(setq nomelist nil)
(princ (strcat "nomelista" (itoa cont))) (princ "\n")
(repeat 5)
(setq pupil (getstring "study name : "))
(setq nomelist (cons allievo nomelista))
)
(read (strcat "nomelista" (itoa cont)))
(setq cont (1+ cont))
)
)
 
Thank you very much!!! The code works and you solved a big problem! I'm guessing what the line does

(read (strcat "nomelista" (itoa cont)))

with the set and read commands that I did not know, I hope in the lunch break to deepen!
Thank you again
mk
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top