packages feed

egison-5.0.0: sample/prime-millionaire.egi

--
-- This file has been auto-generated by egison-translator.
--

def combs {a} (xs: [a]) : [[a]] :=
  matchAll xs as multiset something with
    | $x_1 :: (loop $i (2, $n)
                 ($x_i :: ...)
                 _) -> map 1#x_$1 (between 1 n)

def p? (xs: [Integer]) : Bool :=
  match xs as list integer with
    | #[1] -> False
    | _ -> isPrime (read (S.concat (map show xs)))

def main (args: [String]) : IO () := each (compose show print) (filter p? (combs (map read args)))