title: How to code a buffer in functional programming
body: <p>During the enforced break I decided to revisit a raytracer but for a difference I decided to do it with via functional programming rather than imperative.</p>
  <p>However I have an issue: How do you have an offscreen buffer?</p>
  <p>I have a <code>colour</code> class and the buffer would be an array of <code>colour</code> objects, but if a <code>colour</code> object is immutable then you can't simply update the object with a new colour.</p>
  <p>So I was thinking of an array of <code>shared_ptr</code>s but that is swapping into an immutable buffer.</p>
  <p>So my final way is to make strips of 16 (maybe more, maybe less) <code>colour</code> objects and have a linked list between them and when the image is finalised then copy the buffers into the offscreen buffer and flip that.</p>
  <p>Is this the best way of doing it or am I missing a trick here?</p>