Sha256: 5e848b504d96772ca9a0f031875efc72e792d79c7d4f7559141424fb33cf3ff6

Contents?: true

Size: 331 Bytes

Versions: 69

Compression:

Stored size: 331 Bytes

Contents

defmodule Year do
  def leap_year?(year) do
    div4?(year) && div100?(year) == div400?(year)
  end

  defp divides?(dividend, divisor), do: rem(dividend, divisor) == 0
  defp div4?(dividend), do: divides?(dividend, 4)
  defp div100?(dividend), do: divides?(dividend, 100)
  defp div400?(dividend), do: divides?(dividend, 400)
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.138 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.137 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.136 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.135 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.134 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.133 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.132 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.131 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.130 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.129 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.128 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.127 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.126 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.125 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.124 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.123 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.122 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.121 tracks/elixir/exercises/leap/example.exs
trackler-2.2.1.120 tracks/elixir/exercises/leap/example.exs