head<T> function
- NonEmptyList<
T> list
Returns the first item of the list
.
var nel = NonEmptyList([1, 2, 3]);
print(head(nel)); // 1
Implementation
T head<T>(NonEmptyList<T> list) {
return list._items.first;
}
Returns the first item of the list
.
var nel = NonEmptyList([1, 2, 3]);
print(head(nel)); // 1
T head<T>(NonEmptyList<T> list) {
return list._items.first;
}