exercism-common-lisp/pal-picker/pal-picker.lisp
Adam Cooper 577860559e Initial commit
This "initial" commit occurs after five exercises have been completed
2025-01-23 19:43:42 -05:00

31 lines
824 B
Common Lisp

(defpackage :pal-picker
(:use :cl)
(:export :pal-picker :habitat-fitter :feeding-time-p
:pet :play-fetch))
(in-package :pal-picker)
(defun pal-picker (personality)
(case personality
(:lazy "Cat")
(:energetic "Dog")
(:quiet "Fish")
(:hungry "Rabbit")
(:talkative "Bird")
(otherwise "I don't know... A dragon?")))
(defun habitat-fitter (weight)
(cond ((>= weight 40) :massive)
((>= weight 20) :large)
((>= weight 10) :medium)
((>= weight 1) :small)
((<= weight 0) :just-your-imagination)))
(defun feeding-time-p (fullness)
(if (> fullness 20) "All is well." "It's feeding time!"))
(defun pet (pet)
(when (string= pet "Fish") "Maybe not with this pet..."))
(defun play-fetch (pet)
(unless (string= pet "Dog") "Maybe not with this pet..."))