packages feed

egison-3.3.1: sample/demo1.egi

;; Extract all twin primes with non-linear pattern-matching against the infinite list of prime numbers
(define $twin-primes
  (match-all primes (list integer)
    [<join _ <cons $p <cons ,(+ p 2) _>>>
     [p (+ p 2)]]))

;; Enumerate first 10 twin primes
(test (take 10 twin-primes))
;=>{[3 5] [5 7] [11 13] [17 19] [29 31] [41 43] [59 61] [71 73] [101 103] [107 109]}