How can you get input from a user and save that data in a list. e.g.
(format t "First question?")
(let ((firstQuestion (read-line)))
//second question
(let ((secondQuestion (read-line)))
//third
(let ((thirdQuestion (read-line)))
(setq allQuestions '(firstQuestion secondQuestion thirdQuestion))))
so that just gives me a list of those words and not the actually valuse they hold.
Thanks
Saving a list of variables
Re: Saving a list of variables
Code: Select all
(setq allQuestions (list firstQuestion secondQuestion thirdQuestion))
-
- Posts: 61
- Joined: Mon Jul 07, 2008 8:06 pm
- Location: Toowoomba, Queensland, Australia
- Contact:
Re: Saving a list of variables
A hint for posting. For code, please put your code between [ÂÂÂcode] and [ÂÂÂ/code] tags. For example type this into a post:
[/code]
Just press the [ÂÂÂcode] button when you're typing your post to insert the code tags. For more information, see http://lispforum.com/faq.php?mode=bbcode. Don't forget, semi-colon (;) is for Lisp comments, not //. Thanks for listening
.
Code: Select all
[code]
(lisp (lisp (lisp that is)
indented
nicely))
Just press the [ÂÂÂcode] button when you're typing your post to insert the code tags. For more information, see http://lispforum.com/faq.php?mode=bbcode. Don't forget, semi-colon (;) is for Lisp comments, not //. Thanks for listening

Re: Saving a list of variables
Or you can do this:
Code: Select all
(defvar *Q* '("Foo?" "Bar?" "Baz?"))
(loop for question in *Q*
do (format t "~a " question) (finish-output)
collect (read-line))
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.