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
3.1k
Cocoa Kucha Berlin 2013
robb
2
2.1k
ReactiveCocoa NSSpain
robb
18
2.4k
ReactiveCocoa
robb
19
2.7k
Super Mario Masterclass
robb
2
320
Tetris Masterclass
robb
0
530
Other Decks in Programming
See All in Programming
インターフェース設計のコツとツボ
togishima
2
700
Datadog RUM 本番導入までの道
shinter61
1
260
Cursor AI Agentと伴走する アプリケーションの高速リプレイス
daisuketakeda
1
110
カクヨムAndroidアプリのリブート
numeroanddev
0
410
GoのGenericsによるslice操作との付き合い方
syumai
2
490
Prism.parseで 300本以上あるエンドポイントに 接続できる権限の一覧表を作ってみた
hatsu38
1
110
Cline指示通りに動かない? AI小説エージェントで学ぶ指示書の書き方と自動アップデートの仕組み
kamomeashizawa
1
450
Javaのルールをねじ曲げろ!禁断の操作とその代償から学ぶメタプログラミング入門 / A Guide to Metaprogramming: Lessons from Forbidden Techniques and Their Price
nrslib
3
1.9k
Blueskyのプラグインを作ってみた
hakkadaikon
1
520
Beyond Portability: Live Migration for Evolving WebAssembly Workloads
chikuwait
0
350
Practical Tips and Tricks for Working with Compose Multiplatform Previews (mDevCamp 2025)
stewemetal
0
120
実践ArchUnit ~実例による検証パターンの紹介~
ogiwarat
2
250
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Docker and Python
trallard
44
3.4k
Bash Introduction
62gerente
614
210k
BBQ
matthewcrist
89
9.7k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
2.8k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
34k
Typedesign – Prime Four
hannesfritz
42
2.7k
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!