The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

oldfartdeveloper (18) [Avatar] Offline
#1
You show the example of using the capture operator here:

def new(entries \\ []) do
  Enum.reduce(
    entries,
    todo_list,
    &add_entry(&2, &1)
  )
end


The
 todo_list, 
argument is undefined when I try it; needs to be

def new(entries \\ []) do
  Enum.reduce(
    entries,
    %TodoList{},
    &add_entry(&2, &1)
  )
end



Hope this helps!

This is my 2nd book on Elixir, btw. Really learning a lot more from this one, thank you.
sjuric (109) [Avatar] Offline
#2
Good catch, thanks for reporting!
I'm glad you like the book smilie
jfs.world (121) [Avatar] Offline
#3
353525 wrote:This is my 2nd book on Elixir, btw. Really learning a lot more from this one, thank you.


Just out of curiosity (because I am looking at possibly getting this book), what was your first one, and how is this different or better?