main :: [sys_message] main = [Stdout (lay [word ++ ": " ++ show (canmakeword blocks word) | word <- tests])] tests :: [[char]] tests = ["A","BARK","BOOK","TREAT","common","SqUaD","cOnFuSe"] canmakeword :: [[char]]->[char]->bool canmakeword [] word = False canmakeword blocks [] = True canmakeword blocks (a:as) = #match ~= 0 & canmakeword rest as where match = [b | b<-blocks; ucase a $in b] rest = hd match $del blocks del :: *->[*]->[*] del item [] = [] del item (a:as) = a:del item as, if a ~= item = as, otherwise in :: *->[*]->bool in item [] = False in item (a:as) = a = item \/ item $in as ucase :: char->char ucase ch = ch, if ncode 'z' = decode (n-32), otherwise where n = code ch blocks :: [[char]] blocks = ["BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS", "JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"]