I wrote the code to solve the last “Your turn” problem of chapter 7. I have a question regards to my solution. Please find the code in this gist and the question in the gist’s comment. https://gist.github.com/visibletrap/5944509.
I replied on the gist, but want to capture it here too.
I’m new to Elixir too, so take this with a grain of salt, but I’d do your line 6, for example, like this:
(r = [ id: _, ship_to: :TX, net_amount: _ ]) -> Keyword.put(r, :tax, 0.08)
This matches the entire keyword list into r, so you can just create a clone with an additional tax item in it.