blob: baa11c0abfe204dd43f5e5f957713b3944326d92 (
plain) (
tree)
|
|
isRowWord' :: Ord a => [a] -> [a] -> [a] -> Bool
isRowWord' _ ys [] = ys == []
isRowWord' [] [] zs = isRowWord' [head zs] [] (tail zs)
isRowWord' xs [] zs = if last xs <= head zs then isRowWord' (xs ++ [head zs]) [] (tail zs) else isRowWord' [] xs zs
isRowWord' xs ys zs =
if xs == [] || last xs <= head zs
then head ys > head zs && (isRowWord' (xs ++ [head zs]) (tail ys) (tail zs))
else ys == [] && isRowWord' [] xs zs
isRowWord :: Ord a => [a] -> Bool
isRowWord = isRowWord' [] []
|