View Code? Open in Web Editor
NEW
Contém todas as fichas relativas à cadeira de Programação Funcional, do ano letivo 2018/19, e resoluções de testes e exames de anos anteriores.
License: MIT License
programacao-funcional's Issues
I found a bug where the variable "ms" is used instead of "t". This causes the program to crash because "ms" is not defined anywhere.
I am forwarding the answer I think is right.
catMaybes :: [Maybe a] -> [a] catMaybes [] = [] catMaybes ((Just a):t) = a:catMaybes t catMaybes ((Nothing):t) = catMaybes t
Erro na função vizinhos :
Chamada da função myvizinhos
(linha 408 e 409) em vez de vizinhos'
vizinhos' :: Posicao -> [Posicao ] -> [Posicao ]
vizinhos' _ [] = []
vizinhos' (Pos x y) ((Pos xv yv): ps) = if abs (x - xv) == 1 && y == yv || abs (y - yv) == 1 && x == xv
then (Pos xv yv): myvizinhos (Pos x y) ps
else myvizinhos (Pos x y) ps