title: Erlang printing lists
body: <p>Trying to simulate a Towers of Hanoi game for uni, but I can't get the lists to print properly.</p>
  
  <pre><code>-module(hanoi).
  -export([create_towers/1]).
  
  create_towers(0) -&gt;
      [];
  
  create_towers(X) -&gt;
  List = [X | create_towers(X - 1)],
  List1 = lists:sort(List),
  io:format("Tower1: ~p ~n", [List1]).
  </code></pre>
  
  <p>When I run the function:</p>
  
  <pre><code>67&gt; hanoi:create_towers(3).
  Tower1: [1] 
  
  ** exception error: no function clause matching lists:sort([2|ok]) (lists.erl, line 479)
       in function  hanoi:create_towers/1 (hanoi.erl, line 9)
       in call from hanoi:create_towers/1 (hanoi.erl, line 8)
  </code></pre>