egison-4.1.0: sample/demo1-ja.egi
-- 素数の無限リストから全ての双子素数をパターンマッチにより抽出
def twinPrimes :=
matchAll primes as list integer with
| _ ++ $p :: #(p + 2) :: _ -> (p, p + 2)
-- 最初の10個の双子素数を列挙
take 10 twinPrimes
-- => [(3, 5), (5, 7), (11, 13), (17, 19), (29, 31), (41, 43), (59, 61), (71, 73), (101, 103), (107, 109)]