Skip to content

Instantly share code, notes, and snippets.

@yagkasha

yagkasha/cd.lisp Secret

Last active February 9, 2024 20:24
Show Gist options
  • Save yagkasha/6c2e51c8bb1d758d5cc420b2568bf6d0 to your computer and use it in GitHub Desktop.
Save yagkasha/6c2e51c8bb1d758d5cc420b2568bf6d0 to your computer and use it in GitHub Desktop.
;; ERROR
;; FOR SLY:
;; sly-edit-definition: No known definition for: make-cd (in #:practical-common-lisp)
;; FOR SLIME
;; cond: No known definition for: make-cd (in #:practical-common-lisp)
(in-package #:practical-common-lisp)
(defvar *db* nil)
(defun add-record (cd) (push cd *db*))
(defun make-cd (title artist rating ripped)
(list :title title :artist artist :rating rating :ripped ripped))
(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 ;; <------------------------------------- This is where I am hitting M-.
(prompt-read "Title")
(prompt-read "Artist")
(or (parse-integer (prompt-read "Rating") :junk-allowed t) 0)
(y-or-n-p "Ripped [y/n]: ")))
(defun save-db (filename)
(with-open-file (out filename
:direction :output
:if-exists :supersede)
(with-standard-io-syntax
(print *db* out))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment