title: Convert list of codepoints (or binary) to string
body: <p>I've been working on the exercises from Dave Thomas's <a href="https://pragprog.com/book/elixir/programming-elixir" rel="noreferrer">Programming in Elixir</a>. I came across one that says to write a function (called <code>caesar</code> for some reason) that takes a charlist and an integer to add to each element in the charlist, cycling back around to 'a' if it goes past 'z', so you should be able to call it like</p>
  
  <p><code>
  MyList.caesar('ryvke', 13)
  </code></p>
  
  <p>and it should return a string.</p>
  
  <p>I have a function that maps over the list and performs the addition, but it returns a charlist, and I can't figure out how to convert it to a string:</p>
  
  <pre><code>defmodule MyList do
    def caesar(list, n) do
      Enum.map list, &amp;(perform_addition(&amp;1, n))
      |&gt; to_charlist
      |&gt; to_string
    end
  
    defp perform_addition(char_val, n) when char_val &lt; 122 do
      char_val + n
    end
  
    defp perform_addition(_, n) do
      97 + n
    end
  end
  </code></pre>
  
  <p>I've tried:</p>
  
  <ul>
  <li>Reading <a href="https://elixir-lang.org/getting-started/binaries-strings-and-char-lists.html" rel="noreferrer">the docs on binaries, strings, and charlists</a></li>
  <li>Reading about charlists on <a href="https://elixirschool.com/en/lessons/basics/strings/#charlists" rel="noreferrer">ElixirSchool</a></li>
  <li>Trying to convert it from a charlist to a binary and <em>then</em> to a string after following <a href="https://stackoverflow.com/questions/22517250/how-to-convert-an-elixir-binary-to-a-string">this</a> SO question</li>
  </ul>
  
  <p>The attempt based on the last bullet led to:</p>
  
  <pre><code>MyList.caesar('ryvke', 13)
  # =&gt; &lt;&lt;127, 194, 134, 194, 131, 120, 114&gt;&gt;
  </code></pre>