Practical use of improper lists in Erlang (perhaps all functional languages)

后端 未结 4 1641
时光取名叫无心
时光取名叫无心 2020-12-14 23:16

I\'ve been reading Erlang and OTP in action, and stumbled upon a question with regards to improper lists.

Don’t be tempted to use list cel

4条回答
  •  旧时难觅i
    2020-12-14 23:24

    OTP standard digraph module for directed graphs uses improper lists for tagged vertex and edge identifiers. For example, vertex 42 would be identified as ['$v'|42], which means a pair of an atom (no, not a character literal!) and an integer, similarly edge 97 would be ['$e'|97].

提交回复
热议问题