init implementation and tests

Had a real world situation where I wanted all elements of a list except the last one.

In Haskell, the four usual suspects are `head`, `tail`, `init`, and `last`.

Could find `head`, `tail`, and `last` but no init implementation? It is possible it comes under a different name but I couldn't find it.  Also, lodash does have an initial function which is sort of haskell `init` on steroids.

So I am tentatively raising this PR without any expectations, but hopes such a function already exists if declined. Would rather not have to compose this one all the time. :)

My only concern over the proposed implementation was what to do about the case where an empty array is passed in. Am assuming here that returning an empty array is ok. This seems consistent with `tail` etc.


Great point, I took my lead from existing code and did note that there seems to be some confusion in the testcases on this matter. Will fix up now.