{"blog_title":"inamori\u2019s diary","provider_name":"Hatena Blog","image_url":null,"published":"2010-09-02 00:00:00","title":"unfold\uff082\uff09","version":"1.0","url":"https://inamori.hateblo.jp/entry/20100902/p1","categories":["C++"],"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Finamori.hateblo.jp%2Fentry%2F20100902%2Fp1\" title=\"unfold\uff082\uff09 - inamori\u2019s diary\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","author_name":"inamori","author_url":"https://blog.hatena.ne.jp/inamori/","provider_url":"https://hatena.blog","type":"rich","height":"190","description":"\u524d\u56de\u306eunfold\u306f\u7121\u9650\u5217\u3057\u304b\u51fa\u3057\u307e\u305b\u3093\u3002\u305d\u308c\u3092takewhile\u6b62\u3081\u3066\u3044\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u4f8b\u3048\u3070\u6574\u6570\u309210\u9032\u6570\u306b\u5206\u89e3\u3059\u308b\u3053\u3068\u3092\u8003\u3048\u307e\u3059\u300210\u3067\u5272\u3063\u305f\u4f59\u308a\u3092\u51fa\u3057\u3066\u3044\u304f\u3068\u3001 shared_ptr<cIterable<int>> digits(int n) { auto f = [] (int n) { return pair<int,int>(n % 10, n / 10); }; return unfold(f, n); } int main() { cout << digits(123) << endl; } 3 2 1 0 0 0 \u2026\u3068\u5ef6\u3005\u51fa\u529b\u3055\u308c\u3066\u3057\u307e\u3044\u3001\u6b62\u3081\u308b\u65b9\u6cd5\u304c\u3042\u308a\u307e\u305b\u3093\u3002 Haske\u2026","width":"100%","blog_url":"https://inamori.hateblo.jp/"}