Sha256: 8be6349601b0d8d6f291e16459172c085e1276b62b92fad284a27b02bbc1325d

Contents?: true

Size: 415 Bytes

Versions: 395

Compression:

Stored size: 415 Bytes

Contents

module CryptoSquare (encode) where

import Data.Char       (isAlphaNum, toLower)
import Data.List       (transpose)
import Data.List.Split (chunksOf)

encode :: String -> String
encode = unwords
       . transpose
       . (squareSize >>= chunksOf)
       . map toLower
       . filter isAlphaNum
  where
    squareSize :: String -> Int
    squareSize = ceiling . (sqrt :: Double -> Double) . fromIntegral . length

Version data entries

395 entries across 395 versions & 1 rubygems

Version Path
trackler-2.2.1.78 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.77 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.76 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.75 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.74 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.73 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.72 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.71 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.70 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.69 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.68 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.67 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.66 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.65 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.64 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.63 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.62 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.61 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.60 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.59 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs