because trip_items(sunny) will return ‘hat’, and our poor intrepid tripgoer will suffer dehydration and sunburn. Comma in Erlang forms being a sequencing expression separator, and forms only returning the (single) result of the last expression, a traveler wanting multiple items would need the last expression to return them all as a single result, i.e. as a tuple:
One minor nitpick:
It is unnecessarily incorrect and confusing to equate
I will need a few items on my trip: if it’s sunny, sunscreen, water, a hat; if it’s rainy, an umbrella, a raincoat; if it’s windy, a kite, a shirt.
with
tripitems(sunny) -> sunscreen, water, hat; tripitems(rainy) -> umbrella, raincoat; trip_items(windy) -> kite, shirt.
because trip_items(sunny) will return ‘hat’, and our poor intrepid tripgoer will suffer dehydration and sunburn. Comma in Erlang forms being a sequencing expression separator, and forms only returning the (single) result of the last expression, a traveler wanting multiple items would need the last expression to return them all as a single result, i.e. as a tuple:
trip_items(sunny) -> { hat, sunscreen, water };
but this complexifies the discussion.