DEV Community

Discussion on: Help me solve the "Triple Trouble" challenge on Codewars with Elixir.

Collapse
 
antonrich profile image
Anton • Edited

Here's what I've got so far:

defmodule Triple do
  def triple_trouble(one, two, three) do
    first = String.graphemes one
    second = String.graphemes two
    third = String.graphemes three

    List.foldl(first, [], fn char, acc ->
      [char <> Enum.at(second, 0) <> Enum.at(third, 0)] ++ acc
    end)
  end
end

I need to make an expression out of Enum.at(second, 0) so it actually gives the right index. Don't know how to do that yet.