[Haskell-beginners] A simple function V2
es at ertes.de
Fri Aug 31 16:15:38 CEST 2012
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
That's actually not true. See his 'where' clause at the bottom.
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: not available
More information about the Beginners