Intro to Elixir | Lesson 14: Drills and Tips - Part 3

Elixir
22 Views 0 Likes 1 Comments

We will solve the puzzle: find the most recurring letter in a string using Elixir.

Comment
Leave a comment (supports markdown format)
@jarius 7 days ago

I’d never come across Enum.reject before. Glad to know it. Might want to use String.split(“”, trim: true), and save some cycles, or drop the first string replace, and reject on &1 in [“”, “ “].

“Hello World” |> String.split(“”) |> Enum.reject(&(&1 in [“”, “ “] or “Hello World” |> String.replace(“ “, “”) |> String.split(“”, trim: true)