related question: is this also an example of para morphism?<div><br></div><div>here is my current understanding</div><div>cata morphism -> fold/reduce [ e.g. list of numbers -> sum of numbers]</div><div>ana morphism -> unfold/reproduce depending on input [ e.g. one number -> 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 -> 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 -> 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"><<a href="mailto:rpglover64@gmail.com">rpglover64@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I'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't be a problem; I just monadic bind and...<br>
<br>> -- example code<br>> updateCell :: Bool -> RVar Bool<br>> updateCell False = return False<br>> updateCell True = bernoulli (0.9 :: Double)<br><br>> sim = sequence $ take 20 $ unfoldr (\x -> Just (x, x >>= updateCell)) (return True)<br>
<br>> 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't be possible if I'm doing things right... It appears that each cell has an independent history. I'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>