ABC words: Difference between revisions
Content added Content deleted
(→{{header|Diego}}: Added Diego entry) |
(Updated Haskell version) |
||
Line 1,582: | Line 1,582: | ||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
<lang haskell>import Data. |
<lang haskell>import Data.Bool (bool) |
||
import Data.Maybe (isJust) |
|||
------------------------ ABC WORDS ----------------------- |
------------------------ ABC WORDS ----------------------- |
||
Line 1,589: | Line 1,590: | ||
isABC s = |
isABC s = |
||
isJust $ |
isJust $ |
||
residue 'a' "bc" s |
|||
>>= |
>>= residue 'b' "c" |
||
>>= |
>>= (bool Nothing . Just) <*> ('c' `elem`) |
||
residue :: Char -> String -> String -> Maybe String |
|||
residue c except = go |
|||
where |
where |
||
go [] = Nothing |
go [] = Nothing |