Closed trosel closed 7 years ago
the passed "val" (assumed to be a tuple) is being "unboxed"/"destructured"/"pattern matched" such that val's second element is bound to the alias/variable inches, so long as its first element matches the atom :inches
val
is the same as the tuple on the left. It is unused, so redundant here. But it could be useful if the function needed the whole tuple, not only its part, e.g., to pass it to another function.
{:inches, inches} = val
What is that doing? Is it a named tuple? You do not use
val
in the to_light_seconds function, so I'm not sure why it's there at all. And you can simply pass the result to round_up without having it be the name of val, so I just don't understand the point of it in the code. Yet, it's consistently in this entire chapter up until the very end.