I want to compare user input from READ with a string, like so:
CL-USER 36 > (equalp (read) "same")
same
NIL
However, as you can see, even though I type in “same,” EQUALP says my input and the string are different. How can I compare these two?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
read-linefor this:readwould return a symbol:From the Hyperspec:
You just want to read a string, whereas
readparses the input and constructs Lisp objects from it.To get strings out of
read, you’d have to use the “printed representation” of strings, i.e. put them in double quotes:(BTW: There is
string=for string comparisons;equalpwill ignore case.)