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
Jakarta EE meets AI
ivargrimstad
0
1.3k
Cursorでアプリケーションの追加開発や保守をどこまでできるか試したら得るものが多かった話
drumnistnakano
0
310
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
410
CSC305 Lecture 25
javiergs
PRO
0
130
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
320
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
170
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
160
Security_for_introducing_eBPF
kentatada
0
100
MCP with Cloudflare Workers
yusukebe
2
200
Testing Assembly: Code or Low Code - Navigating the Test Automation Options
maaretp
0
110
Java 23の概要とJava Web Frameworkの現状 / Java 23 and Java web framework
kishida
2
400
Haze - Real time background blurring
chrisbanes
1
500
Featured
See All Featured
Designing Experiences People Love
moore
138
23k
The Pragmatic Product Professional
lauravandoore
32
6.3k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Mobile First: as difficult as doing things right
swwweet
222
9k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
Being A Developer After 40
akosma
87
590k
The Cult of Friendly URLs
andyhume
78
6.1k
4 Signs Your Business is Dying
shpigford
181
21k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Statistics for Hackers
jakevdp
796
220k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
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!