Atom - Ḣ
- Head (First)
Characters: Ḣ
Tags: array
Arity: monadic
This atom is monadic, which means it takes one argument.
Functionality
Pop and return the first element of a list (modifies the list).
Details
If the list is empty, returns zero. This mutates the original object itself, so 1,2,3 Ḣ,⁸Ɗ
yields [1, [2, 3]]
, not [1, [1, 2, 3]]
. If you do not want to modify the list, you can access the first element using 1ị$
; however, a clever trick you can employ is ḷ/
(as long as your list isn't empty). This is technically less efficient because you reduce the whole list whereas random access is constant, but can save you a byte over 1ị$
if you would need the $
to group those links.