Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. strings :: Int -> [ String ]
  2. strings 0 = [""]
  3. strings n = concat ( map (\ x -> map (\ tail -> x : tail ) tails ) ['a'.. 'z'])
  4. where tails = strings (n -1)
  5.  
  6. paliTest :: String -> Bool
  7. paliTest "" = True
  8. paliTest a = (a == reverse a)
  9.  
  10. paliListN :: [String] -> [String]
  11. paliListN (x:xs)= if(paliTest x) then x:paliListN xs
  12. else paliListN xs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement