这里还有人吗?Elixir的list 和 tuple

作者 vivianandliliqin 所属板块 问答
when you update a tuple, all entries are shared between the old and the new tuple, except for the entry that has been replaced. In other words, tuples and lists in Elixir are capable of sharing their contents. This reduces the amount of memory allocation the language needs to perform and is only possible thanks to the immutable semantics of the language. 来源https://elixir-lang.org/getting-started/basic-types.html 这句话怎么理解比较好,这个教程里前面说 updating or adding elements to tuples is expensive because it requires creating a new tuple in memory。上面又是all entries are shared between the old and the new tuple 既然entries是共享的 所以新tuple是引用了旧tuple的entries?
7 回复
  • vivianandliliqin 发表
    还不能改头像是咋的啦?老司机才让改?
  • vivianandliliqin 发表
    服务器在digitalocean,难怪速度这么感人
  • Cifer 发表
    头像是直接用的 gavatar 服务, 你可以去了解一下 https://gravatar.com/
  • Cifer 发表
    However, updating or adding elements to tuples is expensive because it requires creating a new tuple in memory, **Note that this applies only to the tuple itself, not its contents.** 注意这句
  • vivianandliliqin 发表
    [@Cifer](/users/14) 注册邮箱没有邮件确认,登录用用户名。我不记得我用的什么邮箱呢
  • jw2013 发表
    [@vivianandliliqin](/users/796) 发你地址了
  • vivianandliliqin 发表
    [@jw2013](/users/1) ok