> > *> let: section_counter <- 1, let: lesson_counter <- 1* > > My concern about this is that `<-` in for means extracting something from > the collection, so giving it another meaning inside an option can be quite > confusing. >
Makes sense. If I'm not mistaken it actually means pulling the next item from an enumerable. How about trying to think of the for/let as generating a new enumerable (stream?) as the "loop" runs? So how about: for section <- sections, section_counter <- let(1) do end Then how about "previous" instead of "let"? for section <- sections, {_value, section_counter, lesson_counter} <- previous({nil, 1, 1}) do # ... {section, section_counter + 1, lesson_counter + 1} end The semantics would be that "<- previous" extracts the previous result of the do block. Once could as well do: for n <- 1..5, p <- previous(1), do: p + n Best, Stefan -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CACzMe7Y9jOeNzTNad5EvwTk%2B48o28qKgyE8cv50Tc3cci4dgYw%40mail.gmail.com.