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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Robert Böhnke
August 21, 2013
Programming
4
1.3k
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.2k
Cocoa Kucha Berlin 2013
robb
2
2.1k
ReactiveCocoa NSSpain
robb
18
2.5k
ReactiveCocoa
robb
19
2.8k
Super Mario Masterclass
robb
2
350
Tetris Masterclass
robb
0
540
Other Decks in Programming
See All in Programming
Event Storming
hschwentner
3
1.3k
Head of Engineeringが現場で回した生産性向上施策 2025→2026
gessy0129
0
210
NOT A HOTEL - 建築や人と融合し、自由を創り出すソフトウェア
not_a_hokuts
2
550
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
2
400
ご飯食べながらエージェントが開発できる。そう、Agentic Engineeringならね。
yokomachi
1
280
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
230
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
2
180
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.4k
CSC307 Lecture 10
javiergs
PRO
1
690
CSC307 Lecture 12
javiergs
PRO
0
450
Rubyと楽しいをつくる / Creating joy with Ruby
chobishiba
0
200
DSPy入門 Pythonで実現する自動プロンプト最適化 〜人手によるプロンプト調整からの卒業〜
seaturt1e
1
480
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
How to build a perfect <img>
jonoalderson
1
5.2k
Color Theory Basics | Prateek | Gurzu
gurzu
0
220
Raft: Consensus for Rubyists
vanstee
141
7.3k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
130
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
63
Statistics for Hackers
jakevdp
799
230k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
250
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Side Projects
sachag
455
43k
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!