Genetic Algorithms in Elixir: Genetic.crossover function, continuity in changes lost (page 93)

You are correct, the code should show:

def crossover(population, opts \\ []) do
  population
  |> Enum.reduce([],
      fn {p1, p2}, acc ->
        cx_point = :rand.uniform(length(p1.genes))
        {{h1, t1}, {h2, t2}} =
          {Enum.split(p1.genes, cx_point),
            Enum.split(p2.genes, cx_point)}
        {c1, c2} =
          {%Chromosome{p1 | genes: h1 ++ t2},
            %Chromosome{p2 | genes: h2 ++ t1}}
        [c1, c2 | acc]
      end
    )
end

I’ll mark this change for the next version as well! Thank you so much!