by shigemk2

当面は技術的なことしか書かない

対話によるCommon Lisp入門 45 case

condはちょっと煩雑なのでswitch

(defun color (fruit)
  (case fruit
    ((apple) 'red)
    ((banana lemon) 'yellow)
    ((peach) 'pink)
    (otherwise "I don't know.")))

(print (color 'lemon))
(print (color 'banana))
(print (color 'peach))
YELLOW 
YELLOW 
PINK