<div dir="ltr"><div><div>I've been working on a project that needs a good fibonacci generator, and I'm to the point where can now improve upon this one: <br><a href="https://wiki.haskell.org/The_Fibonacci_sequence#Fastest_Fib_in_the_West">https://wiki.haskell.org/The_Fibonacci_sequence#Fastest_Fib_in_the_West</a><br><br></div>thanks to this guy:<br><a href="https://groups.google.com/forum/#!topic/haskell-cafe/HUgbAUCvCp4">https://groups.google.com/forum/#!topic/haskell-cafe/HUgbAUCvCp4</a><br><br></div>He suggested breaking up a guard into two diffeent functions, which I can do, but I don't know what to call them because I don't know why the operations are different. I'm referring to this section:<br><br><pre class=""><span class="">fib'</span> <span class="">(</span>f<span class="">,</span> g<span class="">)</span> p
            <span class="">|</span> p         <span class="">=</span> <span class="">(</span>f<span class="">*</span><span class="">(</span>f<span class="">+</span><span class="">2</span><span class="">*</span>g<span class="">)</span><span class="">,</span> f<span class="">^</span><span class="">2</span> <span class="">+</span> g<span class="">^</span><span class="">2</span><span class="">)</span>
            <span class="">|</span> <span class="">otherwise</span> <span class="">=</span> <span class="">(</span>f<span class="">^</span><span class="">2</span><span class="">+</span>g<span class="">^</span><span class="">2</span><span class="">,</span>   g<span class="">*</span><span class="">(</span><span class="">2</span><span class="">*</span>f<span class="">-</span>g<span class="">)</span><span class="">)<br><br>I'd like to know the reason why each guard does two entirely different things, so I know what to call the functions when I seperate them out.<br></span></pre><br></div>