diff --git a/lib/modules/queue_assistant.ex b/lib/modules/queue_assistant.ex index 2b6898c..2dc4582 100644 --- a/lib/modules/queue_assistant.ex +++ b/lib/modules/queue_assistant.ex @@ -387,7 +387,8 @@ defmodule QueueAssistant do # [2, 3, 4, 5] ``` """ - @spec out(queue_type()) :: {:empty | {:value, any()}, queue_type()} + @dialyzer {:nowarn_function, out: 1} + @spec out(queue_type()) :: {:empty, {[], []}} | {{:value, any()}, queue_type()} def out(queue) do :queue.out(queue) end @@ -607,6 +608,15 @@ defmodule QueueAssistant do :queue.peek_r(queue) end + @doc """ + Please see `join/2` and `to_list/1`. + """ + @spec join_to_list(queue_type(), queue_type()) :: list(any()) + def join_to_list(queue, queue1) do + :queue.join(queue, queue1) + |> :queue.to_list() + end + # The "Okasaki API" is inspired by "Purely Functional Data Structures" by Chris Okasaki. # It regards queues as lists. This API is by many regarded as strange and avoidable. # For example, many reverse operations have lexically reversed names, some with more