作者:爱音乐的李雪梅 | 来源:互联网 | 2023-07-17 10:40
```erlang
?
1> Henry8 = #{ class => king, born => 1491, died => 1547 }. #{ born => 1491, class=> king, died => 1547 }.
2> #{ born => B } = Henry8.
#{ born => 1491, class=> king, died => 1547 }.
3> B.
1491
```
这是erlang之父写的书的第二版,里面的代码,可是第二个命令行的语法是错误的,如果你按这个方式输入,会在shell里面报错:illegal pattern。应该用下面的写法。
```erlang
?
3> #{ born := B } = Henry8.
?
#{born => 1491,class => king,died => 1547}
```