Binary digits: Difference between revisions

Content added Content deleted
(→‎{{header|Haskell}}: Added unfolding implementation)
(→‎{{header|Haskell}}: Oops, forgotten reverse)
Line 1,192: Line 1,192:


-- Or even more efficient (due to fusion) and universal implementation
-- Or even more efficient (due to fusion) and universal implementation
toBin2 = foldMap show . toBase 2
toBin2 = foldMap show . reverse . toBase 2


toBase base = unfoldr modDiv
toBase base = unfoldr modDiv