title: Can a pure function depend on an external constant?
body: <p>An article I was reading gives this as an example of an impure function (in JavaScript):</p>
  
  <pre><code>const tipPercentage = 0.15;
  
  const calculateTip = cost =&gt; cost * tipPercentage;
  </code></pre>
  
  <p>That struck me as a bit of an odd example, since <code>tipPercentage</code> is a constant with an immutable value. Common examples of pure functions allow dependence on immutable constants when those constants are functions.</p>
  
  <pre><code>const mul = (x, y) =&gt; x * y
  
  const calculateTip = (cost, tipPercentage) =&gt; mul(cost, tipPercentage);
  </code></pre>
  
  <p>In the above example, correct me if I'm wrong, <code>calculateTip</code> would usually be categorised as a pure function.</p>
  
  <p>So, my question is: In functional programming, is a function still considered pure if it relies on an externally defined constant with an immutable value, when that value is not a function?</p>