In Julia, I’d have expected a similar workflow along the lines of
d = Dict(1=>'a')
clear!(d)
To my surprise, there seems to be no such function clear!(), neither for dicts nor sets. I guess there’s a good reason for this, and likely some best practices to achieve the same outcome. I’d be interested in both. Thanks a lot!
# methodswith(type/module/function)
julia> methodswith(Dict)
[1] serialize(s::Serialization.AbstractSerializer, d::Dict) in Serialization at .
...
[11] empty!(h::Dict{K, V}) where {K, V} in Base at dict.jl:265
...
[30] sizehint!(d::Dict{T}, newsz) where T in Base at dict.jl:232
help?> empty!
search: empty! empty isempty
empty!(collection) -> collection
Remove all elements from a collection.