2 ms·
You have two -- charlists like you're describing, which are just linked lists of characters under the hood and UTF-8 binaries. Charlists are denoted with single
by _asummers 10y ago
You have two -- charlists like you're describing, which are just linked lists of characters under the hood and UTF-8 binaries. Charlists are denoted with single quotes and the UTF-8 ones are denoted with double quotes. Truthfully, I reach for the UTF-8 ones most of the time, but you can get some good performance gains in e.g. template string building in web frameworks if you use charlists. In Erlang, all the strings work like charlists FWIU, so they need to exist at least in some capacity for interop reasons.
http://elixir-lang.org/getting-started/binaries-strings-and-char-lists.html http://elixir-lang.org/getting-started/binaries-strings-and-...
- anuragsoni 10y agoAre you thinking of IO lists[0] when you talk about templates with respect to web frameworks? [0] https://www.bignerdranch.com/blog/elixir-and-io-lists-part-2-io-lists-in-phoenix/ https://www.bignerdranch.com/blog/elixir-and-io-lists-part-2...
- _asummers 10y agoI totally am and now I look silly :) Good catch.
- anuragsoni 10y agoNot at all :) If you haven't read that post by bignerdranch, i'd definitely recommend it. It was interesting read (both parts 1 and 2)