Jump to content

Cantor set: Difference between revisions

m
m (→‎{{header|Phix}}: added syntax colouring the hard way)
Line 891:
Or, using strings for the model as well as the display:
 
<lang haskell>importcantor Data.Bool:: (bool)[String] -> [String]
 
cantor :: [String] -> [String]
cantor = (go =<<)
where
go x =
in| bool'█' == head [x] = [block, replicate m ' ', block] ('█' == head x)
let m = quot (length x) 3
| blockotherwise = take m [x]
where
in bool [x] [block, replicate m ' ', block] ('█' == head x)
let m = quot (length x) 3
block = take m x
 
cantorLines :: Int -> String
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.