small medium large xlarge

18 Sep 2016, 07:55
Amit Lamba (3 posts)

So, we’ve learned about list modules and their sum and map functions. In the example at the bottom of Pg. 58, Joe’s improving the code of total/1 by using these 2 functions. But, why do we have a total/1 exported function when we are no longer calling total/1 as shown in the code?

We have improved total/1, but when executing the code we have used the following commands:

L1 ={What, N}) -> shop:cost(What) * N end, Buy).


So, what’s the point of exporting total/1 if we are not calling:




18 Sep 2016, 08:04
Amit Lamba (3 posts)

Ok, maybe the code shown is meant to be prefaced by, “This is what happens behind the scenes”. I’m guessing the BEAM does exactly what is shown in code behind the scenes.

I think this could be elucidated a bit more to not cause the minor confusion.

Thanks! Great book so far.

You must be logged in to comment