[{"data":1,"prerenderedAt":255},["ShallowReactive",2],{"project-4053301":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":29,"sentiment":30,"stance_mix":31,"scored_comments":34,"aspects":35,"strip":40,"post_text":43,"what":44,"said":68,"maker_in_thread":150,"shape":157,"grid":160,"attempts":217,"same_week":218,"maker_shows":32,"maker_hidden":247,"reader_version":248,"card":249},"4053301","Underscore.m","Underscore.js for Objective-C","title","Show HN: Underscore.js for Objective-C","http:\u002F\u002Funderscorem.org","underscorem.org","robert-boehnke",1338558242,2012,120,25,168,1677,11,"notable","languages","functional library for objective-c","library",[24,25,26,27,28],"objective-c","underscore.js","functional programming","map filter","ios","debated",0.071,{"positive":32,"neutral":32,"mixed":33,"critical":32},2,0,6,{"idea":36,"design":38,"docs":39},{"positive":32,"critical":37},1,{"positive":33,"critical":37},{"positive":33,"critical":33},[33,33,33,33,41,41,37,33,33,33,33,33,33,37,33,42,33,42,33,33,33,33,33,33,33],5,3,null,{"problem":43,"audience":45,"pricing":43,"motivation":43,"time_to_build":43,"stack":56,"openness":67,"stage":67,"team_size":67},{"value":46,"source":47,"evidence":48},"Objective-C and iOS developers","inferred",[49,53],{"id":50,"by":51,"text":52},"4053893","mullr","This brings to mind google's warning re: the use of functional idioms in Java: http:\u002F\u002Fcode.google.com\u002Fp\u002Fguava-libraries\u002Fwiki\u002FFunctionalExplained Objective-C blocks make things…",{"id":54,"by":11,"text":55},"4053624","I've tried that, but once you pass in blocks as arguments, the whole thing becomes a lot harder to read. I have no clue how to indent ``` [[array filter:^BOOL (id obj) { return…",[57],{"value":58,"source":59,"evidence":60},"Objective-C","maker",[61,64],{"id":62,"by":11,"text":63},"4054188","In the case of NSDictionary, Underscore.m's map iterates over objects and keys. Fast Enumeration only iterates over the dictionary's keys, when you probably want the value or…",{"id":65,"by":11,"text":66},"4054289","It's exactly what's used internally :)","unknown",{"praise":69,"objections":86,"requests":112,"questions":120,"alternatives":125},[70,75],{"value":71,"source":72,"evidence":73},"Useful for developers already using underscore.js","commenter",[74],{"id":50,"by":51,"text":52},{"value":76,"source":72,"evidence":77},"Objective-C bracket syntax is not that bad",[78,82],{"id":79,"by":80,"text":81},"4053685","speg","I just spent the last month learning about iOS (and Obj-C). I didn't find the square brackets that terrible. Explicit is better than implicit after all. It seems like dot…",{"id":83,"by":84,"text":85},"4053734","jparishy","Indeed. Plus I think well-designed Objective-C is some of the prettiest code out there. Though I've been using it for a few years now almost exclusively (for the most part) so…",[87,95,106],{"value":88,"source":72,"evidence":89},"Block-based map\u002Ffilter syntax is hard to read and indent",[90,91],{"id":54,"by":11,"text":55},{"id":92,"by":93,"text":94},"4054307","xsmasher","The blocks do make it messy but you don't need them, at least in this simple case, if you write your category to take selectors. [[array filter:@selector(passesTest)]…",{"value":96,"source":72,"evidence":97},"Adding methods to NSObject or categories is bad practice",[98,102],{"id":99,"by":100,"text":101},"4053699","jawngee","It should be a category on NSObject so it supports anything that supports fast enumeration which could be anything. And the indentation in the above is correct. The way you've…",{"id":103,"by":104,"text":105},"4054072","natesm","Uh, I did read it. Yes, it's a bad idea. So is adding random things to NSObject for protocols that it does not conform to. That's actually worse, I'd argue, since you suddenly…",{"value":107,"source":59,"evidence":108},"Objective-C is verbose for common functional operations",[109],{"id":110,"by":11,"text":111},"4054311","I am not saying that named arguments are a bad idea, in fact they are awesome! Often, they make code a lot more readable, consider for example ``` [UIMelon…",[113],{"value":114,"source":72,"evidence":115},"Support any class implementing NSFastEnumeration",[116,119],{"id":117,"by":104,"text":118},"4053900","What's the advantage of implementing map\u002Ffilter as property accessors of a wrapper object instead of just doing: ``` NSArray* map(id\u003CNSFastEnumeration> enumerable, id(^)(id…",{"id":62,"by":11,"text":63},[121],{"value":122,"source":72,"evidence":123},"What is the advantage over plain namespaced functions",[124],{"id":117,"by":104,"text":118},[126,132,143],{"value":127,"source":72,"evidence":128},"Categories on NSArray and NSDictionary",[129],{"id":130,"by":93,"text":131},"4053585","Interesting if you're already used to underscore.js. The more Objective-C way to do this, without the dot syntax and the need for wrapping, is to add categories (sets of extra…",{"value":133,"source":72,"evidence":134},"Underscore.js ports to Perl, Lua and ActionScript",[135,139],{"id":136,"by":137,"text":138},"4053773","draegtun","There are also ports of Underscore.js to Perl & Lua: * http:\u002F\u002Fvti.github.com\u002Funderscore-perl\u002F * http:\u002F\u002Fmirven.github.com\u002Funderscore.lua\u002F",{"id":140,"by":141,"text":142},"4054077","iron_ball","And AS3, if you're into that sort of thing (self-plug): https:\u002F\u002Fgithub.com\u002Famacdougall\u002Funderscore.as",{"value":144,"source":72,"evidence":145},"Plain C functions taking NSFastEnumeration objects",[146,147],{"id":117,"by":104,"text":118},{"id":148,"by":104,"text":149},"4053857","Objective-C is a superset of C, functions can be just that - a function. Especially for higher-order functions like map and filter. Not everything needs to be glued to an object.",{"comments":41,"answered":37,"key":151},[152,153,156],{"id":54,"text":55},{"id":154,"text":155},"4054348","as long as you don't need additional arguments :)",{"id":62,"text":63},{"commenters":158,"max_depth":34,"maker_replies":41,"first_comment_mins":159,"lifespan_hours":41},15,48,[161,163,167,170,172,174,175,177,179,181,182,184,185,189,191,192,194,196,200,202,206,207,209,212,214],[50,33,33,162,51,33],"other\u002Fneutral\u002Fidea",[164,37,33,165,166,33],"4053680","commenter\u002Fneutral\u002Fnone","cpr",[168,37,33,165,169,33],"4054762","travisjeffery",[171,37,33,165,166,33],"4054784",[136,32,41,173,137,33],"project\u002Fpositive\u002Fidea",[140,32,41,173,141,33],[130,42,37,176,93,33],"project\u002Fcritical\u002Fidea",[54,42,33,178,11,37],"project\u002Fneutral\u002Fdesign",[99,42,33,180,100,33],"commenter\u002Fcritical\u002Fdesign",[148,42,33,180,104,33],[183,42,33,180,100,33],"4053936",[103,42,33,180,104,33],[186,42,33,187,188,33],"4053707","other\u002Fneutral\u002Fdesign","wsc981",[92,42,37,190,93,33],"project\u002Fcritical\u002Fdesign",[154,42,33,180,11,37],[117,193,42,178,104,33],4,[62,193,33,195,11,37],"project\u002Fneutral\u002Fexecution",[197,193,42,198,199,33],"4054253","maker\u002Fneutral\u002Fdocs","joubert",[65,193,33,201,11,37],"maker\u002Fneutral\u002Fexecution",[203,41,33,204,205,33],"4053545","other\u002Fcritical\u002Fdesign","tubbo",[79,41,33,187,80,33],[83,41,33,208,84,33],"other\u002Fpositive\u002Fdesign",[210,41,33,211,100,33],"4053719","other\u002Fneutral\u002Fnone",[110,41,33,213,11,37],"project\u002Fpositive\u002Fdesign",[215,41,33,187,216,33],"4054659","batista",[],[219,224,229,234,238,242],{"id":220,"name":221,"points":222,"category":223},"4054568","movies.io",550,"consumer_social",{"id":225,"name":226,"points":227,"category":228},"4053554","Sock of the Month Club",243,"web_saas",{"id":230,"name":231,"points":232,"category":233},"4053553","lalo.li",143,"creative",{"id":235,"name":236,"points":237,"category":223},"4053579","doodlec.am",135,{"id":239,"name":240,"points":241,"category":223},"4048329","My first personal app",107,{"id":243,"name":244,"points":245,"category":246},"4053860","discuss.io",93,"productivity",false,"v2",{"id":250,"name":5,"line":6,"ai":247,"cat":20,"year":13,"points":14,"comments":15,"rec":29,"s":251,"top":18,"kw":252,"maker":11,"domain":10,"tier":19,"attempts":33,"strip":253,"url":9,"mix":254,"praise":71,"objection":88,"sub":21},4053301,0.07,[24,25,26,27,28],"0000551000000103030000000",[32,32,33,32],1793990881927]