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.0.6.0 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.18 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.17 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.16 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.15 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.14 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.13 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.12 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.11 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.10 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.9 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.8 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.7 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.6 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.5 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.4 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.3 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.2 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.1 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs
trackler-2.0.5.0 tracks/haskell/exercises/crypto-square/examples/success-standard/src/CryptoSquare.hs