3 ms·
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 r
by riwsky 12y ago
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.
- tel 12y agoYeah, 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.
- tel 12y agoHere's how to work it without even using the state monad: https://news.ycombinator.com/item?id=8149200 https://news.ycombinator.com/item?id=8149200 It's quite a bit different from this formulation.