crislanio_macedo Posted March 9, 2015 at 01:23 AM Report Share #578996 Posted March 9, 2015 at 01:23 AM (edited) Olá queria fazer uma função que dada duas listas, devolva uma lista com a união das listas dadas, sem repetição de elementos. uniao   = uniao  (x:xs) =(x:xs) uniao (x:xs)  =(x:xs) uniao (x:xs)(y:ys) | x<y = x:uniao xs (y:ys) | x==y = x: uniao xs ys | otherwise = y: uniao (x:xs) y Erro. Prelude> :l Exercicios-2Entrega.hs [1 of 1] Compiling Main ( Exercicios-2Entrega.hs, interpreted ) Exercicios-2Entrega.hs:114:39: Occurs check: cannot construct the infinite type: a0 = [a0] In the second argument of `uniao', namely `y' In the second argument of `(', namely `uniao (x : xs) y' In the exp<b></b>ression: y : uniao (x : xs) y Failed, modules loaded: none. Edited March 9, 2015 at 03:06 AM by thoga31 GeSHi Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now