Genetic Algorithms in Elixir: initialize/2 wrong arity (page 25)

At the top of page 25 is

Below initialize/2 , create a new function named evaluate:

At this point of the development the definition of initialize (previous page 24) just use one parameter:

def initialize(genotype) do
  for _ <- 1..100, do: genotype.()
end

The text should read:

Below initialize/1 , create …

Skipping forward to examine when initialize gets its second param I also spotted on page 28:

def initialize(opts \\ []) do
  # ...omitted...
end

which should be:

def initialize(genotype, opts \\ []) do
  # ...omitted...
end

as we can find correctly in the next page 29.

1 Like

Good catch! Thank you, I’ll fix this.

1 Like