Skip to content

Instantly share code, notes, and snippets.

@hedgehog1024
hedgehog1024 / spiral.hs
Created May 31, 2018 16:03
An efficient (I guess) way to create a spiral in haskell as list of lists
cons = (:)
baseSeed =
[[1, 1, 1, 1, 1]
,[0, 0, 0, 0, 1]
,[1, 1, 1, 0, 1]
,[1, 0, 0, 0, 1]
,[1, 1, 1, 1, 1]]
baseSpiral = map (foldr (.) id) . map (map cons) $ baseSeed