Created
August 12, 2011 14:29
-
-
Save sedm0784/1142148 to your computer and use it in GitHub Desktop.
Pratical: A Simple Database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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]: "))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(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.