title: What is convention for local vars that has same meaning as function argument?
body: <p>What is convention for local vars that has same meaning as function argument? </p>
  
  <p>If I need <strong>local variable</strong> that has as its initial state value of <strong>function argument</strong> (and thus has the <strong>same meaning</strong>), how should I call it? </p>
  
  <p>As artificial example (that, however, demonstrates quite popular construction in Clojure): </p>
  
  <pre><code>(defn sum [coll]
    (loop [local-coll coll, result 0]
      (if (empty? local-coll)
         result
         (recur (rest local-coll) (+ (first local-coll) result)))))
  </code></pre>
  
  <p>Here <code>local-coll</code> is initialized to the value of <code>coll</code> initially, and it also holds this meaning during looping. <code>local-coll</code> is definitely not a good name for it, but what is? </p>
  
  <p>In Haskell it is a good style to put quote (<code>'</code>) to the end of variable/function name, e.g. <code>var'</code>. In Common Lisp sometimes I saw names ending with asterisk (<code>*</code>). Clojure has same notation for <em>function</em> that duplicate another function meaning but have a bit different semantics (e.g. <a href="http://clojure.github.com/clojure/clojure.core-api.h..." rel="nofollow">list*</a>). But this notation is also frequently used in docstrings to indicate that there may be several items of this type (e.g. <code>(methodname [args*] body)*</code> or <code>(try expr* catch-clause* finally-clause?)</code>) and thus can confuse when used for local var names.
  Java interop also provides things like <code>defn-</code>, that is names ending with hyphen (<code>-</code>) to indicate private methods in generated classes. So it makes some sense to use hyphen for local (private for a function) variables too (though it seems a bit weird for me).</p>
  
  <p>So, what the way should I go when naming my local variables with the same meaning as function argument?</p>