common-lisp Pattern matching Constructor patterns

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Cons-cells, structures, vectors, lists and such can be matched with constructor patterns.

(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


Got any common-lisp Question?