defun 定义匹配

使用模式匹配,可以将函数定义和模式匹配交织在一起,类似于 SML。

(trivia:defun-match fib (index)
  "Return the corresponding term for INDEX."
  (0 1)
  (1 1)
  (index (+ (fib (1- index)) (fib (- index 2)))))

(fib 5)
;; => 8