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.139 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.138 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.137 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.136 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.135 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.134 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.133 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.132 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.131 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.130 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.129 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.128 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.127 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.126 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.125 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.124 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.123 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.122 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.121 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.2.1.120 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs