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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
270
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
590
並行開発のためのコードレビュー
miyukiw
0
280
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
220
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
470
CSC307 Lecture 09
javiergs
PRO
1
840
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.8k
dchart: charts from deck markup
ajstarks
3
990
Grafana:建立系統全知視角的捷徑
blueswen
0
330
Package Management Learnings from Homebrew
mikemcquaid
0
230
「ブロックテーマでは再現できない」は本当か?
inc2734
0
1k
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
140
Featured
See All Featured
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
440
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Faster Mobile Websites
deanohume
310
31k
Testing 201, or: Great Expectations
jmmastey
46
8k
How to Talk to Developers About Accessibility
jct
2
130
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.8k
A designer walks into a library…
pauljervisheath
210
24k
What's in a price? How to price your products and services
michaelherold
247
13k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
54
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
83
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.9k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
350
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!