In CL an apostrophe means a quotation so 'y is a quoted one-char symbol. #\y is the standard CL representation of character.Furthermore, I misapprehend your problem, can you elaborate on the reading of char from Java? And what is \#?

I'm reading a char from my Java application and passing to the LISP using sockets. Then in LISP I read the char using read-char and assing it to the variable char. Then I try to evaluate the variable char with the characters y or n using #\y, #\n and if is true, I return 'y or 'n

My problem is that I don't want to return 'y or 'n, because I want to return the value of the char variable.

If I try this:

((eql char #\y) char) it doesn't work but if I try this ((eql char #\y) 'y) it works fine. That's why I don't understand what's the difference and why I can't return the char variable. I undestand that the char variable has the #\y value.

It's possible that the char variable has another characters like return?

If you want to return the character itself, (format nil "~A" char) would be the most convenient way to convert it into a string, which I'm guessing is the effect you want. If char has the value #\y, it will returnthe string "y".The problem with returning 'y is that this is a symbol. In Lisp, this is a very different thing from a character or a string - CL serialises them in different ways. You can convert 'y to "y", but it's better not to create that problem in the first place.

In case that doesn't answer the question, when you say that it doesn't work, what error do you get? That would help us figure out what's breaking and where.

One last thing: (t (char)) doesn't do what you probably think it does. It means that the default case is to evaluate the function #'char with no arguments, and to return the result. (t char), or possibly (t (format nil "~A" char)) is much more likely to work the way you want.