Skip to content

Instantly share code, notes, and snippets.

@gnumonik
Created April 16, 2021 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnumonik/5e1682b6ec02e25c1bbdf97b4811ee00 to your computer and use it in GitHub Desktop.
Save gnumonik/5e1682b6ec02e25c1bbdf97b4811ee00 to your computer and use it in GitHub Desktop.
lol
import Control.Comonad.Store
import Data.Char
thing :: [Char] -> [[Char]]
thing [] = []
thing xss@(x:xs) =
let rotate n xs = reverse $ take (length xs) (drop n (cycle xs))
ys = toUpper : (replicate (length xs) id)
f (n,zs) = zipWith (\g x -> g x) (rotate n ys) zs
myStore = store f (1,xss)
in map (\x -> peeks (\(y,z) -> (x,z)) myStore) [1.. length xss]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment