small medium large xlarge

07 Jul 2013, 19:03
Nuttanart Pornprasitsakul (1 post)

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.

07 Jul 2013, 23:16
Greg Vaughn (5 posts)

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.

  You must be logged in to comment