-3
我學習Erlang和我試圖理解這個代碼,作爲一個例子。編程使用Erlang
-module(tutorial5).
-export([format_temps/1]).
format_temps(List_of_cities) ->
convert_list_to_c(List_of_cities).
convert_list_to_c([{Name, {f, F}} | Rest]) ->
Converted_City = {Name, {c, (F -32)* 5/9}},
[Converted_City | convert_list_to_c(Rest)];
convert_list_to_c([City | Rest]) ->
[City | convert_list_to_c(Rest)];
convert_list_to_c([]) ->
[].
我不確定如何使用這些方法來獲得我所需要的。我知道這個最深的是,我應該能夠形成城市及其下的列表,然後能夠把自己的溫度華氏從轉換爲攝氏溫度,反之亦然。任何幫助,將不勝感激。
你有一個具體的問題? – akonsu