Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Doesn't ztake need to live in State Int (or something similar)? As written, I don't see how it passes the 'n' onto the next call. It seems that the transducer returned by ztake n for any n > 1 will always pass on (f1 result, z1).

Thank you for posting this though, helpful to see someone work through it.



Here's how to work it without even using the state monad: https://news.ycombinator.com/item?id=8149200

It's quite a bit different from this formulation.


Yeah, I'm working through it in more depth now (I just fired this off last night quickly without a lot of thought). There's more to be said about take. My implementation here totally does not work.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: