Skip to content

Instantly share code, notes, and snippets.

@sedm0784
Created August 12, 2011 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sedm0784/1142148 to your computer and use it in GitHub Desktop.
Save sedm0784/1142148 to your computer and use it in GitHub Desktop.
Pratical: A Simple Database
(defun make-cd (title artist rating ripped)
(list :title title :artist artist :rating rating :ripped ripped))
(defvar *db* nil)
(defun add-record (cd) (push cd *db*))
(defun dump-db ()
(dolist (cd *db*)
(format t "~{~a:~10t~a~%~}~%" cd)))
(defun prompt-read (prompt)
(format *query-io* "~a: " prompt)
(force-output *query-io*)
(read-line *query-io*))
(defun prompt-for-cd ()
(make-cd
(prompt-read "Title")
(prompt-read "Artist")
(or (parse-integer (prompt-read "Rating") :junk-allowed t) 0)
(y-or-n-p "Rippled [y/n]: ")))
@sedm0784
Copy link
Author

(example from Practical Common Lisp)

When running (prompt-for-cd) in the SBCL REPL, it works as expected, and as described in the tutorial.

However, when running it from within slimv, it prompts for the title, but when Enter is pressed, it skips the prompt for the artist and jumps straight to the prompt for the Rating.

CL-USER> (prompt-for-cd)
Title: It's a CD!
Artist: Rating: 9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment