1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
-module(bar). -vsn(1). -export([simple/1, complicated_sum/1]). simple(X) -> case lists2:assoc(simple, X) of {ok, Val} -> Val; false -> false end. complicated_sum([X, Y, Z]) -> cs(X, Y, Z). cs([HX | TX], [HY | TY], [HZ | TZ]) -> NewRes = cs(TX, TY, TZ), [HX + HY + HZ | NewRes]; cs([], [], []) -> [].