title: Functional Programming Dependencies: How to share dependencies between functions that aren't connected together direct
body: <p>these different functions are composed together like so</p>
  
  <pre><code>f1 -&gt; f2 -&gt; f3 -&gt; f4 -&gt; f5
  </code></pre>
  
  <p>I need to add two new functions fx and fy around f3 like so:</p>
  
  <pre><code>f1 -&gt; f2 -&gt; fx -&gt; f3 -&gt; fy -&gt; f4 -&gt; f5
  </code></pre>
  
  <p>so I need to pre-process the argument for f3 and then post-process the output from f3</p>
  
  <p>here function fx makes a change and fy reverts the change back, but fy needs additional details from fx to be able to revert, to know what values to revert to for example </p>
  
  <p>the problem is that function fx needs to produce two outputs </p>
  
  <pre><code>first: output that is needed by f3
  second: output that is needed by fy
  </code></pre>
  
  <p>Question: 
  How to share dependencies between functions that are not connected together direct, 
  is there a spacial way/technique to solve this?</p>
  
  <p>FYI, I'm using Java8</p>