Let's see what we need to do:
- for each number I'm between 999 and 100
- for every number j between i and 100
- take the product i * j
The easiest way to create such a nested enumeration is to create a nested list of lists and then smooth it out or use the function immediately flat_map:
Stream.flat_map(999..100, fn i -> Stream.map(i..100, fn j -> j * i end) end)
source
share