Re:Continued Fractions in Haskell
by yakshaving_jgt on Wednesday April 21, 2021 @07:21AM
(#26888078)
Which easy thing do you think is hard to do in Haskell?
[ Parent
| on HN ]
Printing is the classic answer.
Mutable arrays, for the clever people who know how or print.
Also, looking at the article, the cryptic "fix" operator for making a cyclic structure. Elegant, beautiful, efficient, but mysterious.
Re:Continued Fractions in Haskell
by yakshaving_jgt on Wednesday April 21, 2021 @10:10AM
(#26889923)
Perhaps I’m missing something, but printing stuff in Haskell seems pretty simple.
print “hello world”
As for mutable arrays, is there something wrong with Data.Array.MArray from the array[0] library?Here's a cyclic structure. Seems very easy to me. No cryptic operator required!
let one_zeros = 1 : zero_ones
zero_ones = 0 : one_zerosMonadic anamorphisms
Re:Continued Fractions in Haskell
by yakshaving_jgt on Wednesday April 21, 2021 @10:06AM
(#26889864)
Are you suggesting monadic anamorphisms are easy in other languages but hard in Haskell? Could you give an example for comparison?
I was being facetious, you can certainly do stuff like anamorphisms easily in other languages, but the hard work of pulling out and expressing the abstraction is definitely a job for Haskell.
Anyway here's one from Data.Functor.Foldable.Exotic just for fun:
anaM :: (Corecursive t, Traversable (Base t), Monad m) => (a -> m (Base t a)) -> (a -> m t)
anaM psi = a where a = (fmap embed . traverse a) <=< psi