-- setelem.hs: elem and set functions -- -- Copyright (C) 2021-2025 Rudy Matela -- Distributed under the 3-Clause BSD licence (see the file LICENSE). import Conjure elem' :: Int -> [Int] -> Bool elem' x [y] = x == y elem' x [y,z] = x == y || x == z elem' x [y,z,w] = x == y || x == z || x == w set' :: [Int] -> Bool set' [] = True set' [x] = True set' [x,y] = not (x == y) set' [x,y,z] = not (x == y || y == z || x == z) main :: IO () main = do conjure "elem" (elem') [ con ([] :: [Int]) , con True , con False , fun "||" (||) , fun "&&" (&&) , fun "not" not , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "==" ((==) :: Int -> Int -> Bool) ] conjure "set" (set') [ con ([] :: [Int]) , con True , con False , fun "&&" (&&) , fun "||" (||) , fun "not" not , fun ":" ((:) :: Int -> [Int] -> [Int]) , fun "elem" (elem :: Int -> [Int] -> Bool) ]