[Haskell-beginners] A simple function V2

Brent Yorgey byorgey at seas.upenn.edu
Fri Aug 31 20:59:43 CEST 2012


On Fri, Aug 31, 2012 at 04:15:38PM +0200, Ertugrul Söylemez wrote:
> Brent Yorgey <byorgey at seas.upenn.edu> wrote:
> 
> > > *intercalate :: (Eq t) => [t] -> [t] -> [t]*
> > > *intercalate (x:xs) (y:ys)*
> > > * | xt == [] = []*
> > > * | yt == [] = []*
> > > * | otherwise = x : y : intercalate xs ys*
> > > * where xt=(x:xs)*
> > > *            yt=(y:ys)*
> >
> > I should also point out that the tests xt == [] and yt == [] will
> > never be true!  That is because xt is defined to be (x:xs) and yt is
> > (y:ys).
> 
> That's actually not true.  See his 'where' clause at the bottom.

That's exactly what I was looking at.  Can you clarify what you mean?
Which part of what I said is not true?

-Brent



More information about the Beginners mailing list