Anonymous user
Substitution cipher: Difference between revisions
m
→{{header|Haskell}}: simplified convert, and generified types
m (→{{header|Haskell}}: simplified convert, and generified types) |
|||
Line 868:
=={{header|Haskell}}==
<lang haskell>import Data.Char (chr)
import Data.Maybe (fromMaybe)
import Data.Tuple (swap)
import System.Environment (getArgs)
Line 879 ⟶ 880:
cipherMap = zip alphabet (shuffle 20 alphabet)
shuffle :: Int ->
shuffle n xs = iterate go xs !! n
where
Line 886:
go xs = go (drop 2 xs) <> take 2 xs
convert :: Eq a => [(
convert
runCommand :: Command -> String
|