Skip to content

Instantly share code, notes, and snippets.

@petros
Created August 23, 2022 13:59
Show Gist options
  • Save petros/a6115fd860bd793a07c9e4552b9df0e2 to your computer and use it in GitHub Desktop.
Save petros/a6115fd860bd793a07c9e4552b9df0e2 to your computer and use it in GitHub Desktop.
Chessboard - Elixir - Exercism
defmodule Chessboard do
@spec rank_range :: Range.t()
def rank_range, do: 1..8
@spec file_range :: Range.t()
def file_range, do: ?A..?H
@spec ranks :: list(integer())
def ranks, do: Enum.to_list(rank_range())
@spec files :: list(String.t())
def files, do: Enum.map(file_range(), &<<&1>>)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment