title: "using" function
body: <p>I've defined 'using' function as following:</p>
  
  <pre><code>def using[A, B &lt;: {def close(): Unit}] (closeable: B) (f: B =&gt; A): A =
    try { f(closeable) } finally { closeable.close() }
  </code></pre>
  
  <p>I can use it like that:</p>
  
  <pre><code>using(new PrintWriter("sample.txt")){ out =&gt;
    out.println("hellow world!")
  }
  </code></pre>
  
  <p>now I'm curious how to define 'using' function to take any number of parameters, and be able to access them separately:</p>
  
  <pre><code>using(new BufferedReader(new FileReader("in.txt")), new PrintWriter("out.txt")){ (in, out) =&gt;
    out.println(in.readLIne)
  }
  </code></pre>