&gt; head extracts the first element of a list, which must be non-empty.<p>Those functions operate on lists. I think it should read as follows.<p><pre><code>    const head = (xs) =&gt; xs[0];
    const last = (xs) =&gt; xs[xs.length-1];
    const tail = (xs) =&gt; xs.slice(1);
    const init = (xs) =&gt; xs.slice(0, -1);
</code></pre>
Am I missing something?