4

I'm trying to learn Lisp by reading Practical Common Lisp and I've hit a small stumbling block early on when trying to read user input. I've defined prompt-read to prompt the user for input:

(defun prompt-read (prompt)
  (format *query-io* "~a: " prompt)
  (force-output *query-io*)
  (read-line *query-io*))

When I try to evaluate prompt-read, pressing [Enter] to run the statement seems to be accepted as the input so the resulting input is blank

>(prompt-read "Test")
Test: 
""
NIL

I followed the example exactly, so I'm assuming that this is somehow related to my environment. I am using Emacs Inferior Lisp in Windows, is there some adjustment I have to make to my code in order to get the behavior I expect?

mclark1129
  • 7,532
  • 5
  • 48
  • 84

1 Answers1

3

There seems to be nothing wrong with your code, and it also correctly runs with e.g. SBCL on MS Windows. Instead of inferior lisp mode (that is really inferior) why don't you give a try at using SLIME to edit and run your CL code inside Emacs? You can install it quickly by following this guides:

Emre Sevinç
  • 8,211
  • 14
  • 64
  • 105
  • Thanks, I'll try SLIME tonight to see if that resolves my issue. I didn't bother with it up front since various sites recommended using the default inferior mode while learning / exploring the language. – mclark1129 Apr 25 '12 at 14:06