2
學習藥劑基礎知識我想嘗試這樣做,它做什麼,我希望,在地圖靈藥匹配類型映射的關鍵
gg=%{:a => 1, 2 => :b, %{ :a => 5 } => 8}
gg[:a] # give 2
%{ :a => k } = gg # gives k = 2
gg[%{ :a => 5 }] # gives 8
但有什麼具體的問題是:
%{ %{ :a => 5 } => k } = gg
的我得到的錯誤是
** (CompileError) hello.exs:46: only association operators '=>' are
allowed in map construction
(stdlib) lists.erl:1338: :lists.foreach/2
(elixir) lib/code.ex:363: Code.require_file/2
發生了什麼事?