;;;
;;;
;;; Pattern-matching against sequence of natural numbers
;;;
;;;
;; Extract all twin primes from the infinite list of prime numbers with pattern-matching!
(define $twin-primes
(match-all primes (list integer)
[>>
[p (+ p 2)]]))
;; Enumerate the first 10 twin primes
(take 10 twin-primes)
;; Extract all prime-triplets from the infinite list of prime numbers with pattern-matching!
(define $prime-triplets
(match-all primes (list integer)
[>>>
[p m (+ p 6)]]))
;; Enumerate the first 10 prime triplets
(take 10 prime-triplets)