Sha256: cc2011fabb5ef51890576c5422d707c55facdc8d17d22446af827696c79832d1

Contents?: true

Size: 1.54 KB

Versions: 284

Compression:

Stored size: 1.54 KB

Contents

defmodule LinkedList do
  @opaque t :: tuple()

  @doc """
  Construct a new LinkedList
  """
  @spec new() :: t
  def new() do
    # Your implementation here...
  end

  @doc """
  Push an item onto a LinkedList
  """
  @spec push(t, any()) :: t
  def push(list, elem) do
    # Your implementation here...
  end

  @doc """
  Calculate the length of a LinkedList
  """
  @spec length(t) :: non_neg_integer()
  def length(list) do
    # Your implementation here...
  end

  @doc """
  Determine if a LinkedList is empty
  """
  @spec empty?(t) :: boolean()
  def empty?(list) do
    # Your implementation here...
  end

  @doc """
  Get the value of a head of the LinkedList
  """
  @spec peek(t) :: {:ok, any()} | {:error, :empty_list}
  def peek(list) do
    # Your implementation here...
  end

  @doc """
  Get tail of a LinkedList
  """
  @spec tail(t) :: {:ok, t} | {:error, :empty_list}
  def tail(list) do
    # Your implementation here...
  end

  @doc """
  Remove the head from a LinkedList
  """
  @spec pop(t) :: {:ok, any(), t} | {:error, :empty_list}
  def pop(list) do
    # Your implementation here...
  end

  @doc """
  Construct a LinkedList from a stdlib List
  """
  @spec from_list(list()) :: t
  def from_list(list) do
    # Your implementation here...
  end

  @doc """
  Construct a stdlib List LinkedList from a LinkedList
  """
  @spec to_list(t) :: list()
  def to_list(list) do
    # Your implementation here...
  end

  @doc """
  Reverse a LinkedList
  """
  @spec reverse(t) :: t
  def reverse(list) do
    # Your implementation here...
  end
end

Version data entries

284 entries across 284 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.179 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.178 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.177 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.176 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.175 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.174 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.173 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.172 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.171 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.170 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.169 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.167 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.166 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.165 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.164 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.163 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.162 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.161 tracks/elixir/exercises/simple-linked-list/linked_list.exs
trackler-2.2.1.160 tracks/elixir/exercises/simple-linked-list/linked_list.exs