G'day all.

Quoting Cetin Sert <[EMAIL PROTECTED]>:

-- proposition
data Prp a = Var a
           | Not (Prp a)
           | Or  (Prp a) (Prp a)
           | And (Prp a) (Prp a)
           | Imp (Prp a) (Prp a)
           | Xor (Prp a) (Prp a)
           | Eqv (Prp a) (Prp a)
           | Cns Bool
           deriving (Show, Eq)

This is probably the fastest:

vars :: Prp a -> [a]
vars p = vars' p []
  where
    vars' (Var a) = (a:)
    vars' (Not p) = vars' p
    vars' (Or l r) = vars' l . vars' r
    {- etc -}
    vars' (Cns _) = id

Cheers,
Andrew Bromage
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to