loading...

Discussion on: Daily Challenge #22 - Simple Pig Latin

Collapse
brightone profile image
Oleksii Filonenko

Elixir:

defmodule PigLatin do
  def pig_it(input) do
    input
    |> String.split()
    |> Enum.map(&latinate/1)
    |> Enum.join(" ")
  end

  defp latinate(<<first_letter::binary-size(1), rest::binary>>),
    do: rest <> first_letter <> "ay"
end