small medium large xlarge

09 Sep 2014, 02:54
Raul Murciano (2 posts)

The maps/query.exs example in the “Pattern Matching and Updating Maps” section uses two concepts which I think haven’t been presented before in the book: for and <-.

for​ person = %{ height: height } <- people,
    height > 1.5,
    ​do​: IO.inspect person

They apparently correspond to something called “generator” that hasn’t been described before either:

The generator clause binds each map…

Until this point the book does an great job presenting concepts incrementally. Perhaps a different example can be used here, or perhaps these concepts can be explained at this point, or at least a “bear with me here” hint can be added to prevent a “did I miss something?” feeling in the reader?

Thank you Dave - I’m really enjoying the book so far.

You must be logged in to comment