Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Underscore.m + Asterism
Search
Robert Böhnke
August 21, 2013
Programming
4
1.2k
Underscore.m + Asterism
My talk on Underscore.m and Asterism for CocoaHeads Berlin
Robert Böhnke
August 21, 2013
Tweet
Share
More Decks by Robert Böhnke
See All by Robert Böhnke
Brooklyn iOS Developer Meetup February 2014
robb
8
2.9k
Cocoa Kucha Berlin 2013
robb
2
2.1k
ReactiveCocoa NSSpain
robb
18
2.4k
ReactiveCocoa
robb
19
2.7k
Super Mario Masterclass
robb
2
300
Tetris Masterclass
robb
0
510
Other Decks in Programming
See All in Programming
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
CSC305 Lecture 25
javiergs
PRO
0
130
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
310
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
フロントエンドのディレクトリ構成どうしてる? Feature-Sliced Design 導入体験談
osakatechlab
8
4.1k
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
540
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
710
第5回日本眼科AI学会総会_AIコンテスト_3位解法
neilsaw
0
170
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
300
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
110
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
510
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
Transcript
[email protected]
github.com/robb
Let's talk about
Let's talk about Objective-C
Let's talk about Objective-C talk about
[ ]
transitionFromViewController: toViewController: duration: options: animations: completion:
videoComposition: shouldContinueValidatingAfter FindingInvalidTrackIDInInstruction: layerInstruction: asset:
predicateWithLeftExpression: rightExpression: modifier: type: helpMe: iAmTrappedInAMethodFactory: options:
//
new Grapefruit(0, 10);
[CHGrapefruit grapefruitWithSeeds:0 tastiness:10];
duh!
[NSDictionary dictionaryWithObjectsAndKeys:value, key, nil];
@{ key: value }
enumerateObjectsUsingBlock:
enumerateKeysAndObjectsUsingBlock:
each?
map?
reduce?
filter?
Underscore.m
inspired by underscore.js
not trying to turn Objective-C into JavaScript
not trying to turn Objective-C into JavaScript though it looks
kinda like it…
DSL for data manipulation
Underscore.wrap(array) .filter(^(id obj) { return [obj tastiness] > 8; })
.map(^(id obj) { return [obj juice]; }) .unwrap;
wtf?
@property USDictWrapper *(^map)(USMapBlock block);
foo.method1().method2();
// Nocilla stubRequest(@"GET", @"https://api.example.com") .withHeader(@"Accept", @"application/json");
// Expecta expect(CocoaHeads).to.beFun();
but
- (NSDictionary *)us_map:(USMapBlock block);
[[dictionary us_map:^(id key, id value) { return …; }] us_filter:^(id
object) { return …; }];
Check out BlocksKit
DSL
github.com/robb/Underscore.m
Asterism
Underscore.dictWrap(dictionary).map(block).unwrap; Underscore.arrayWrap(array).map(block).unwrap;
Underscore.dictMap(dictionary, block); Underscore.arrayMap(array, block);
Underscore.dictEach(dictionary, block); Underscore.arrayEach(array, block);
Asterism
__attribute__((overloadable))
ASTEach(NSArray *array, void(^block)(id obj)); ASTEach(NSArray *array, void(^block)(id obj, NSUInteger idx));
ASTEach(NSSet *set, void(^block)(id obj)); …
github.com/robb/Underscore.m github.com/robb/Asterism
thanks!