-module(shopping). -export([totals/0]). % constantize items/0 % https://stackoverflow.com/a/10863003/88340 -compile({inline, [{items, 0}]}). items() -> [{apple, 5, 2}, {banana, 10, 3}]. totals() -> [{Key, Quantity * Price} || {Key, Quantity, Price} <- items()].