I think the reason you don’t find these in a library is that, as mentioned above, linked lists are more of a programming exercise concept than something anyone would use in serious deployment. That said,
julia> list = l1
julia> item = nothing
julia> for i=1:3
item, list = iterate(list)
end
julia> item
3
julia> list = l1
julia> for i=1:(3-1)
item, list = iterate(list)
end
julia> list.tail = cons(100, list.tail)
julia> l1
list(1, 2, 3, 100, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
- For any list
list,list.tailis a pointer to the next node.