0
一個Erlang匹配規範支持與記錄以下方式在匹配規範的MatchHead:如何在匹配規範的MatchHead中用地圖替換記錄?
#recordName{field1=1, field='$1', _='_'}
這所有recordName
記錄從具有field1 == 1
一個表匹配,也確實的field
的隱式綁定可以在以後使用MatchBody。
是否有與地圖類似的東西?
我試過(除了谷歌)的語法如下(ES):
% ERROR: * 1: only association operators '=>' are allowed in map construction
#{key:=1, key:='$1', _:='_'}
和
% ERROR: * 1: illegal use of variable '_' in map
#{key=>1, key=>$1', _=>'_'}
是否有可能做到這一點和語法的地方記錄我找不到?或者,對地圖替換記錄的想法是錯誤的嗎?
TIA
編輯: 也許還不支持。剛剛看到this的帖子。