title: Erlang Looping through a list (or set) to process files
body: <p>I want to create 16 directories in Erlang.
  for ( create_dir("work/p" ++ A, where A is an element in a list [0, 1, ... f]) (sixteen number in hex notation).</p>
  
  <p>I could of course write sixteen lines like: mkdir ("work/p0"), mkdir("work/p1") etc.</p>
  
  <p>I have looked at lists:foreach. In the examples fun is used, is possible to define a function outside the loop and call it?</p>
  
  <p>I am new to Erlang and used to C++ etc.</p>