建構函式模式
Cons-cell,結構,向量,列表等可以與建構函式模式匹配。
(loop for i from 1 to 30
do (format t "~5<~a~;~>"
(match (cons (mod i 3)
(mod i 5))
((cons 0 0) "Fizzbuzz")
((cons 0 _) "Fizz")
((cons _ 0) "Buzz")
(_ i)))
when (zerop (mod i 5)) do (terpri))
; 1 2 Fizz 4 Buzz
; Fizz 7 8 Fizz Buzz
; 11 Fizz 13 14 Fizzbuzz
; 16 17 Fizz 19 Buzz
; Fizz 22 23 Fizz Buzz
; 26 Fizz 28 29 Fizzbuzz