#!/usr/local/bin/sbcl --script (defun foo (&key a b c) (list a b c)) (format t "~a~%" (foo :a 1 :b 2 :c 3)) (format t "~a~%" (foo :c 3 :b 2 :a 1)) (format t "~a~%" (foo :a 1 :c 3) ) (format t "~a~%" (foo)) (defun foo (&key a (b 20) (c 30 c-p)) (list a b c c-p)) (format t "~a~%" (foo :a 1 :b 2 :c 3)) (format t "~a~%" (foo :c 3 :b 2 :a 1)) (format t "~a~%" (foo :a 1 :c 3) ) (format t "~a~%" (foo)) (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*)) (add-record (make-cd "Roses" "Kathy Mattea" 7 t)) (add-record (make-cd "Fly" "Dixie Chicks" 8 t)) (add-record (make-cd "Home" "Dixie Chicks" 9 t)) (defun dump-db () (dolist (cd *db*) (format t "~{~a:~10t~a~%~}~%" cd))) ;(dump-db) (defun select-by-artist (artist) (remove-if-not #'(lambda (cd) (equal (getf cd :artist) artist)) *db*)) (defun select (selector-fn) (remove-if-not selector-fn *db*)) (defun artist-selector (artist) #'(lambda (cd) (equal (getf cd :artist) artist))) (format t "~a~%" (select (artist-selector "Dixie Chicks")))