online advertising

Thursday, June 4, 2015

Haskell 99 Problem 15


Please find the problem here.


Please see the solution as follow:

I could have use map, replicate and ++ to implement this. But I think using ++ is not good, we will repeatedly scan built string. So I used a more direct algorithm for this. It appears that I am not using tail recursion, but with Haskell's lazy evaluation, I think that is not a problem, because the rest of the list will not be evaluated until I want more element, not sure if that's is right though.

No comments :

Post a Comment