What is this empty! function in Julia?

Hi, the following is the code, excepted from OpenStreetMap package. This interesting empty! function confuses me.

type OSMattributes
    oneway::Bool
    oneway_override::Bool
    oneway_reverse::Bool
    visible::Bool
    lanes::Int

    name::UTF8String
    class::UTF8String
    detail::UTF8String
    cycleway::UTF8String
    sidewalk::UTF8String
    bicycle::UTF8String

    # XML elements
    element::Symbol # :None, :Node, :Way, :Tag[, :Relation]
    parent::Symbol # :Building, :Feature, :Highway
    way_nodes::Vector{Int} # for buildings and highways

    id::Int # Uninitialized
    lat::Float64 # Uninitialized
    lon::Float64 # Uninitialized

    OSMattributes() = new(false,false,false,false,1,
                          "","","","","","",:None,:None,[])
end

function reset_attributes!(osm::OSMattributes)
    osm.oneway = osm.oneway_override = osm.oneway_reverse = osm.visible = false
    osm.lanes = 1
    osm.name = osm.class = osm.detail = osm.cycleway = osm.sidewalk = osm.bicycle = ""
    osm.element = osm.parent = :None
    empty!(osm.way_nodes)  # <--- confused
end

I can not find any documentation about this function. Is it because it is deprecated? Any comments are greatly appreciated.

Type ?empty! in REPL for the docs.

3 Likes

For the sake of completeness :wink:

help?> empty!
search: empty! empty isempty

  empty!(collection) -> collection


  Remove all elements from a collection.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> A = Dict("a" => 1, "b" => 2)
  Dict{String,Int64} with 2 entries:
    "b" => 2
    "a" => 1

  julia> empty!(A);

  julia> A
  Dict{String,Int64} with 0 entries
2 Likes