Proposal: Add variants of tails & inits not returning empty lists

Maxime Henrion mux at
Wed Dec 19 10:06:10 EST 2007

Neil Mitchell wrote:
> Hi Maxime,
> > inits1 = tail . inits
> > tails1 = init . tails
> They look useful, and I have used ones like these before. However, the
> name is slightly misleading. foldr1 and foldl1 don't "not return the
> empty list", but both crash if given the empty list. These ones do
> something very similar and very different from the other ...1
> functions, so giving them similar names might result in confusion.
> That said, I can't think of anything better.

Yeah, I agree those names aren't great and could lead to confusion.
I have thought about calling them tails' and inits' but I think
that would be worse, since the trailing single quote is used to
indicate a more strict version most of the time and this has nothing
to do with strictness.

At least the tails1 and inits1 names carry the same "non-empty list"
concept as foldl1 and foldr1, although in a different sense.

Anyone has any better suggestion?


More information about the Libraries mailing list