From Ruby to Elixir: Stuck at the start (page 20)

I managed to install asdf, then erlang and elixir via asdf.

I was able to create and test the example Mix project (page 19) successfully.

I’m confused where to put the very first example: one.ex with two functions (hello/0 and welcome/1). The filenames given start with elixir_examples/lib so I assumed that ‘lib’ is the same lib directory created on page 19, and thus created the one.ex file in a new examples/modules directory. However, running iex as shown on page 21 generates a “function Examples.Modules.One.hello/0 is undefined (module Examples.Modules.One is not available)” error message. I am invoking $ iex -S mix from the same directory that contains lib and mix.exs.

I’ve played around for a couple hours and am stumped. Thanks in advance for a hint!

Can you paste your file that contains defmodule Examples.Modules.One ? The module should be in lib, and the file name does not matter. The only thing that matters is you define the module and functions in a file that’s inside of lib.

BTW, all of the books code is available on the website at From Ruby to Elixir: Unleash the Full Potential of Functional Programming by Stephen Bussey (Search “Source Code”). I highly recommend this if you get really stuck on something, because it may be a really simple missed command or misunderstanding somewhere.