{"id":7149,"date":"2013-03-16T14:20:15","date_gmt":"2013-03-16T19:20:15","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=7149"},"modified":"2013-03-16T14:20:16","modified_gmt":"2013-03-16T19:20:16","slug":"lazy-evaluation-and-streaming-with-nsfastenumeration","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2013\/03\/16\/lazy-evaluation-and-streaming-with-nsfastenumeration\/","title":{"rendered":"Lazy Evaluation and Streaming With NSFastEnumeration"},"content":{"rendered":"<p><a href=\"http:\/\/intersections.tumblr.com\/post\/45407022357\/lazy-evaluation-and-streaming-with-nsfastenumeration\">Rob Rix<\/a>:<\/p>\n<blockquote cite=\"http:\/\/intersections.tumblr.com\/post\/45407022357\/lazy-evaluation-and-streaming-with-nsfastenumeration\"><p>Since Wolf and Michael&rsquo;s posts, the old <code>RXMap<\/code> that took a second argument as the collection to fold the mapped results into is gone. In its place is an <code>RXMap<\/code> which returns an object conforming to <code>NSFastEnumeration<\/code> instead of an instance of a collection class. <code>RXMap<\/code> is dead; long live <code>RXMap<\/code>!<\/p>\n<p>[&#8230;]<\/p>\n<p>The latter two benefits can be summed up as lazy evaluation and streaming. Enumerating a long chain of maps with a <code>for(in)<\/code> loop will only take as much CPU time and memory as is required for each stage to complete, and the results will be processed as soon as they&rsquo;re available, rather than waiting for each stage to complete before going on to the next. All this without threads or asynchrony!<\/p>\n<\/blockquote>\n<p>It&rsquo;s tricky to get <code>NSFastEnumeration<\/code> right, especially with ARC, but his framework hides much of the messiness&mdash;and it sounds like a future version will hide more.<\/p>","protected":false},"excerpt":{"rendered":"<p>Rob Rix: Since Wolf and Michael&rsquo;s posts, the old RXMap that took a second argument as the collection to fold the mapped results into is gone. In its place is an RXMap which returns an object conforming to NSFastEnumeration instead of an instance of a collection class. RXMap is dead; long live RXMap! [&#8230;] The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[55,168,69,54,74,71,340],"class_list":["post-7149","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-arc","tag-blocks","tag-cocoa","tag-objective-c","tag-opensource","tag-programming","tag-rxcollections"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=7149"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7149\/revisions"}],"predecessor-version":[{"id":7150,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7149\/revisions\/7150"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=7149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=7149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=7149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}