<div dir="ltr"><div>Thanks for your response Erik. It appears I have not articulated my question well enough.<br></div>When p is odd, why is the return value <br><pre><span>(</span>f<span>*</span><span>(</span>f<span>+</span><span>2</span><span>*</span>g<span>)</span><span>,</span> f<span>^</span><span>2</span> <span>+</span> g<span>^</span><span>2</span><span>)<br></span></pre><pre><span>as opposed to the return value of<br><br></span><span>(</span>f<span>^</span><span>2</span><span>+</span>g<span>^</span><span>2</span><span>,</span>   g<span>*</span><span>(</span><span>2</span><span>*</span>f<span>-</span>g<span>)</span><span>)<br><br></span></pre><pre><span>What is it about the boolean value that requires two entirely seperate things to be done?<br></span></pre></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 6, 2016 at 7:38 PM, Erik Rantapaa <span dir="ltr"><<a href="mailto:erantapaa@gmail.com" target="_blank">erantapaa@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div class="h5"><br><br>On Friday, May 6, 2016 at 6:46:26 PM UTC-5, Michael Litchard wrote:<blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><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" rel="nofollow" target="_blank">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" rel="nofollow" target="_blank">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><span>fib'</span> <span>(</span>f<span>,</span> g<span>)</span> p
            <span>|</span> p         <span>=</span> <span>(</span>f<span>*</span><span>(</span>f<span>+</span><span>2</span><span>*</span>g<span>)</span><span>,</span> f<span>^</span><span>2</span> <span>+</span> g<span>^</span><span>2</span><span>)</span>
            <span>|</span> <span>otherwise</span> <span>=</span> <span>(</span>f<span>^</span><span>2</span><span>+</span>g<span>^</span><span>2</span><span>,</span>   g<span>*</span><span>(</span><span>2</span><span>*</span>f<span>-</span>g<span>)</span><span>)<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></div></blockquote><div><br></div></div></div><div>Clearly `p` is a Bool, and it comes from the expression:</div><div><br></div><div>     map (toEnum . fromIntegral) $ unfoldl divs n</div><div><br></div><div>What's going on in `toEnum . fromIntegral` is that a remainder (either 0 or 1 - it blows up for anything else) is being converted to a Bool, with 0 mapping to False and 1 mapping to True. So `isOdd` would be a more descriptive name for `p`.</div><div><br></div></div></blockquote></div><br></div>