title: Does functional programming avoid state?
body: <p>According to <a href="http://en.wikipedia.org/wiki/Functional_programming" rel="nofollow noreferrer">wikipedia</a>: functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and <strong>avoids state</strong> and mutable data. (emphasis mine).</p>
  <p>Is this really true? My personal understanding is that it makes the state more explicit, in the sense that programming is essentially applying functions (transforms) to a given state to get a transformed state. In particular, constructs like monads let you carry the state explicitly through functions. I also don't think that any programming paradigm can avoid state altogether.</p>
  <p>So, is the Wikipedia definition right or wrong? And if it is wrong what is a better way to define functional programming?</p>
  <p><strong>Edit</strong>: I guess a central point in this question is <em>what is state?</em> Do you understand state to be variables or object attributes (mutable data) or is immutable data also state? To take an example (in F#):</p>
  <pre><code>let x = 3
  let double n = 2 * n
  let y = double x
  printfn &quot;%A&quot; y
  </code></pre>
  <p>would you say this snippet contains a state or not?</p>
  <p><strong>Edit 2</strong>: Thanks to everyone for participating. I now understand the issue to be more of a linguistic discrepancy, with the use of the word <code>state</code> differing from one community to the other, as Brian mentions in his comment. In particular, many in the functional programming community (mainly Haskellers) interpret <code>state</code> to carry some state of dynamism like a signal varying with time. Other uses of <code>state</code> in things like <em>finite state machine</em>, <em>Representational State Transfer</em>, and <em>stateless network protocols</em> may mean different things.</p>