<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:12px"> <div id="yui_3_16_0_1_1425915261811_9415" dir="ltr"><span id="yui_3_16_0_1_1425915261811_9374">Hello,</span></div><div id="yui_3_16_0_1_1425915261811_9414" dir="ltr"><span></span><br></div><div id="yui_3_16_0_1_1425915261811_11890" dir="ltr"><span id="yui_3_16_0_1_1425915261811_11889">I am facing a slight difficulty trying to do something while saving intermediate calculations</span></div><div id="yui_3_16_0_1_1425915261811_9420" dir="ltr"><span><br></span></div><div id="yui_3_16_0_1_1425915261811_9417" dir="ltr"><span><br></span></div><div id="yui_3_16_0_1_1425915261811_9613" dir="ltr"><span>week</span> <span id="yui_3_16_0_1_1425915261811_9373">actual_ sales</span><span>(</span><span id="yui_3_16_0_1_1425915261811_9372">a</span><span id="yui_3_16_0_1_1425915261811_9371">)</span> <span id="yui_3_16_0_1_1425915261811_11070">forecast</span><span>(</span><span>f</span><span>)</span> <span id="yui_3_16_0_1_1425915261811_9430">forecast</span><span>(</span><span>f</span><span>)</span> <span>forecast</span><span>(</span><span>f</span><span>)</span><br><span> 1</span> <span id="yui_3_16_0_1_1425915261811_11121">20</span> <span>f1</span> <span>=</span> <span id="yui_3_16_0_1_1425915261811_9370">a1</span> <span>f1</span> <span>=</span> <span>20</span> <span>f1</span> <span>=</span> <span>20</span><br><span> 2</span> <span>27</span> <span id="yui_3_16_0_1_1425915261811_9369">f2</span> <span>=</span> <span id="yui_3_16_0_1_1425915261811_9367">f1</span> <span>+</span> <span id="yui_3_16_0_1_1425915261811_11884">0.5</span><span>*</span><span>(</span><span>a1</span> <span>-</span> <span id="yui_3_16_0_1_1425915261811_9416">f1</span><span>)</span> <span>f2</span> <span id="yui_3_16_0_1_1425915261811_9431">=</span> <span>20</span> <span>+</span><span>0.5</span><span>(</span><span>20</span><span>-</span><span>20</span><span>)</span> <span id="yui_3_16_0_1_1425915261811_11892">f2</span> <span>=</span> <span>20</span><br><span id="yui_3_16_0_1_1425915261811_10342"> 3</span> <span>25</span> <span>f3</span> <span>=</span> <span id="yui_3_16_0_1_1425915261811_11880">f2</span> <span>+</span> <span>0.5</span><span>*</span><span>(</span><span>a2</span><span>-</span><span>f2</span><span>)</span> <span id="yui_3_16_0_1_1425915261811_11069">f3</span> <span>=</span> <span>20</span><span>+</span><span>0.5</span><span>*</span><span>(</span><span>27</span><span>-</span><span>20</span><span id="yui_3_16_0_1_1425915261811_11893">) </span> <span id="yui_3_16_0_1_1425915261811_11891">f3</span><span id="yui_3_16_0_1_1425915261811_9429">=</span><span id="yui_3_16_0_1_1425915261811_9428">23.5</span><br><span id="yui_3_16_0_1_1425915261811_10343"> 4</span> <span>22</span> <br><br><br><span id="yui_3_16_0_1_1425915261811_9376">When</span> <span>I</span> <span id="yui_3_16_0_1_1425915261811_9375">execute</span> a <span id="yui_3_16_0_1_1425915261811_10352">function to achieve this</span> <span id="yui_3_16_0_1_1425915261811_10357">in</span> <span id="yui_3_16_0_1_1425915261811_9368">Haskell</span><span>,</span> <span>I</span> <span id="yui_3_16_0_1_1425915261811_9411">get</span> <span>the</span> <span>forecast</span> <span id="yui_3_16_0_1_1425915261811_11931">for</span> <span>the</span> <span>fourth</span> <span id="yui_3_16_0_1_1425915261811_11894">period</span><span>.</span> <span>Can</span> <span>I</span> <span>save</span> <span>the</span> <span>values</span> <span>for</span> <span>intermediate</span> <span id="yui_3_16_0_1_1425915261811_11937">period(1..3)</span> <span id="yui_3_16_0_1_1425915261811_11936">also</span><span>?</span><br></div><div id="yui_3_16_0_1_1425915261811_10312" dir="ltr"><br></div><div id="yui_3_16_0_1_1425915261811_9446" dir="ltr"><br></div><div id="yui_3_16_0_1_1425915261811_9445" dir="ltr">Please find my Haskell code below:</div><div id="yui_3_16_0_1_1425915261811_9408" dir="ltr"><br><span>a</span> <span>=</span> <span>0.5</span><br><span>ipt</span> <span>=</span> <span>[</span><span>20</span><span>,</span><span>27</span><span>,</span><span id="yui_3_16_0_1_1425915261811_9377">25</span><span>,</span><span id="yui_3_16_0_1_1425915261811_11926">22</span><span>]</span><br><span>avg</span> <span id="yui_3_16_0_1_1425915261811_9433">::</span> <span>[</span><span id="yui_3_16_0_1_1425915261811_9434">Double</span><span>]</span> <span>-></span> <span id="yui_3_16_0_1_1425915261811_9440">Double</span><br><span>avg</span> <span>(</span><span>x</span><span>:</span><span>xs</span><span>)</span> <span>=</span> <span>(</span><span>a</span><span id="yui_3_16_0_1_1425915261811_9378">*</span><span>x</span><span>)</span> <span>+</span> <span>(</span><span>1</span><span>-</span><span id="yui_3_16_0_1_1425915261811_9435">a</span><span>)</span><span>*</span><span>(</span><span id="yui_3_16_0_1_1425915261811_11122">avg</span> <span id="yui_3_16_0_1_1425915261811_10365">xs</span><span>)</span><br><span></span></div><div id="yui_3_16_0_1_1425915261811_9432" dir="ltr"><span>avg</span> <span>[]</span> <span>=</span> <span>0</span></div><div id="yui_3_16_0_1_1425915261811_10366"><br></div><div id="yui_3_16_0_1_1425915261811_10369" dir="ltr">Could you please help me with this, thanking you in anticipation</div><span id="yui_3_16_0_1_1425915261811_10368"><div id="yui_3_16_0_1_1425915261811_10369" dir="ltr"><br></div></span><div id="yui_3_16_0_1_1425915261811_9453" dir="ltr"><span><br></span></div><div id="yui_3_16_0_1_1425915261811_9447" dir="ltr"><span id="yui_3_16_0_1_1425915261811_9448">Regards,</span></div><div id="yui_3_16_0_1_1425915261811_9452" dir="ltr"><span>Abhinav</span></div></div></body></html>