Elixir 队列模块
2023-12-16 20:47 更新
队列是一种数据结构,它有效地实现了(双头的)FIFO(先进先出)队列:
iex> q = :queue.new
iex> q = :queue.in("A", q)
iex> q = :queue.in("B", q)
iex> {value, q} = :queue.out(q)
iex> value
{:value, "A"}
iex> {value, q} = :queue.out(q)
iex> value
{:value, "B"}
iex> {value, q} = :queue.out(q)
iex> value
:empty
以上内容是否对您有帮助:
更多建议: