Cantor set: Difference between revisions
m
→Haskell Interval bars: Tidied
(→{{header|Haskell}}: Tidied, pruned out an import.) |
m (→Haskell Interval bars: Tidied) |
||
Line 1,376:
Or, using strings for the model as well as the display:
<lang haskell>
cantor :: [String] -> [String]
cantor = (go =<<)
where
Line 1,385 ⟶ 1,387:
m = quot (length x) 3
block = take m x
--------------------------- TEST -------------------------
cantorLines :: Int -> String▼
cantorLines n =▼
main :: IO ()
main = putStrLn $ cantorLines 5
------------------------- DISPLAY ------------------------
▲cantorLines :: Int -> String
unlines . (concat <$>)
. ( take
<*> ( iterate cantor
. return
. flip replicate '█'
. (3 ^)
. pred
)
)</lang>
{{Out}}
<pre>█████████████████████████████████████████████████████████████████████████████████
|