related question: is this also an example of  para morphism?<div><br></div><div>here is my current understanding</div><div>cata morphism -&gt; fold/reduce [ e.g. list of numbers -&gt; sum of numbers]</div><div>ana morphism -&gt;  unfold/reproduce depending on input [ e.g. one number -&gt; list of reapeated instances of same number]</div>
<div>        some functions like map can be written both as a cata and as an ana.</div><div>hylo morphism -&gt; ana followed by cata [ e.g. recursion trees of function calls are ana, and the return path to the final evaluation is cata]</div>
<div>para morphism -&gt; kind of ana but depends on input and output generated so far fib, fact etc?</div><div><br></div><div>Im not sure i understood the last one well.</div><div><br><div>Thanks</div><div>Cheers</div><div>
Ram</div><div><br><br><div class="gmail_quote">On Mon, Sep 13, 2010 at 11:42 AM, Alex Rozenshteyn <span dir="ltr">&lt;<a href="mailto:rpglover64@gmail.com">rpglover64@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I&#39;m trying to build a list where each entry depends on the previous one.  Unfoldr seemed like a good idea at the time.<br>Unfortunately, my values are monadic values (specifically RVars, from the random-fu package).  Okay, shouldn&#39;t be a problem; I just monadic bind and...<br>

<br>&gt; -- example code<br>&gt; updateCell :: Bool -&gt; RVar Bool<br>&gt; updateCell False = return False<br>&gt; updateCell True  = bernoulli (0.9 :: Double)<br><br>&gt; sim = sequence $ take 20 $ unfoldr (\x -&gt; Just (x, x &gt;&gt;= updateCell)) (return True)<br>

<br>&gt; runRVar sim DevURandom<br clear="all">[True,True,True,True,True,False,True,False,True,False,False,False,False,False,False,True,True,False,False,False]<br><br>That output shouldn&#39;t be possible if I&#39;m doing things right...  It appears that each cell has an independent history.  I&#39;m stumped.<br>

Advice on threading monad input in general and random-fu in specific would be appreciated.<br><font color="#888888"><br>-- <br><div dir="ltr"><div>          Alex R</div></div><br>
</font><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div></div>