Cantor set: Difference between revisions

Content added Content deleted
(Added XPL0 example.)
Line 1,598: Line 1,598:


cantor :: (Rational, Rational) -> [[(Rational, Rational)]]
cantor :: (Rational, Rational) -> [[(Rational, Rational)]]
cantor = iterate (>>= go) . return
cantor = iterate (go =<<) . pure
where
where
go (x, y) = [(x, x + r), (y - r, y)]
go (x, y) = [(x, x + r), (y - r, y)]