[Haskell-beginners] A simple function V2
Ertugrul Söylemez
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
> (y:ys).
That's actually not true. See his 'where' clause at the bottom.
Greets,
Ertugrul
--
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...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120831/6fa93f8d/attachment-0001.pgp>
More information about the Beginners
mailing list