Created
May 6, 2020 12:48
-
-
Save crclark96/adeb18b9279f16195dc97e7d03d2dc06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*Main> oneRow ["candy","doodle","pop","shield","lag","typewriter"] | |
["pop","lag","typewriter"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List (intersect) | |
r0 = "`1234567890-=~!@#$%^&*()_+" | |
r1 = "qwertyuiop[]\\QWERTYUIOP{}|" | |
r2 = "asdfghjkl;'ASDFGHJKL:\"" | |
r3 = "zxcvbnm,./ZXCVBNM<>?" | |
oneRow :: [String] -> [String] | |
oneRow = filter oneRow' | |
where oneRow' s = or $ map (subset s) [r0,r1,r2,r3] | |
subset xs ys = intersect xs ys == xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment