[Haskell-beginners] Data.Stream interleave implementation question

Brent Yorgey byorgey at seas.upenn.edu
Wed Feb 12 17:19:39 UTC 2014


On Wed, Feb 12, 2014 at 03:10:21PM +0700, Kim-Ee Yeoh wrote:
> On Wed, Feb 12, 2014 at 11:23 AM, Bryan Brady <bryan.brady at gmail.com> wrote:
> 
> > ruler :: Stream Integer
> > ruler = foldr1 interleaveStreams (map streamRepeat [0..])
> >
> 
> This is an interesting solution.
> 
> I'd hazard to say that it's probably not the solution the author had in
> mind, so bonus points for novelty!

You're right that it's not the exact solution I had in mind, but I
like it!  I had in mind a more directly recursive version of ruler; I
think proving the two solutions equivalent should not be too hard.

-Brent


More information about the Beginners mailing list