際際滷
Submit Search
FRP - Functional Reactive Programming
?
20 likes
?
4,557 views
Ryo Kamimura
Follow
v方リアクティブプログラミングを粥稼糸姻看庄糸や庄或皆で聞ってみた三
Read less
Read more
1 of 27
Download now
Downloaded 13 times
More Related Content
FRP - Functional Reactive Programming
1.
FRP Functional Reactive Programming 2014/08/01 Ryo
Kamimura
2.
いいか?みんな (?д? ) (| y
|) v方侏プログラミングの勣殆をリアクティブプログラミングに栽わせると v方侏 (?д?) リアクティブ 棕| y |棕 FRPになるのだ ( ?д?) FRP (棕棕
3.
(reactive) ( ) ( )
(behavior)
4.
(stateless) (immutable) (map, filter, fold)
5.
Java Objective-C FRP RxJava compile 'com.netflix.rxjava:rxjava-core:+' ReactiveCocoa pod
'ReactiveCocoa'
6.
Push Pull Push Pull
7.
( ) Pull java.lang.Iterable, RACSequence(ReactiveCocoa) Push rx.Observable(RxJava),
RACSignal(ReactiveCocoa) Push
8.
Push UI 3 next completed error
10.
(Java) ViewObservable.input(mEditText, false) .subscribe(new Action1<String>()
{ @Override public void call(String s) { Log.d("LOG", "New value: " + s); } }, new Action1<Throwable>() { @Override public void call(Throwable t) { Log.d("LOG", "Error: " + t.getMessage()); } }, new Action0() { Override public void call() { Log.d("LOG", "Completed."); } });
11.
(Objective-C) [self.textField.rac_textSignal subscribeNext:^(id x){ NSLog(@"New
value: %@", x); } error:^(NSError *error){ NSLog(@"Error: %@", error); } completed:^{ NSLog(@"Completed."); }];
12.
FRP KVO UI
13.
Transformation Filtering Combining Injection
14.
Transformation map() / map: flatMap()
/ flattenMap:
15.
Filtering filter() / filter: skip()
/ skip: throttleWithTimeout() / throttle:
16.
Combining merge() / merge: zip()
/ zip:reduce:
17.
Injection doOnEach() / doNext: doOnCompleted()
/ doCompleted: doOnError() / doError:
18.
FRP 1. 2. 3. 500 4. 5.
19.
Java 8 ViewObservable.input(mEditText, false) .filter(text
-> { // 秘薦、鬟船Д奪して return isValidText(text); }) .throttleWithTimeout(500, TimeUnit.MILLISECONDS) // 500ミリ昼參坪 .flatMap(text -> { // 秘薦、鬟稀`バ`に僕佚 return sendTextObservable(text); }) .flatMap(jsonResponse -> { // レスポンスの、鯤垢辰瀞拔肇稀`バ`からデ`タ函誼 return resultObservable(jsonResponse.get("result")); }) .observeOn(AndroidSchedulers.mainThread()) // UIスレッドで .subscribe(jsonResponse -> { // UIを厚仟 }, throwable -> { Log.d("LOG", "An error occurred: " + throwable.getMessage()); });
20.
Objective-C [[[[[[[self.textField rac_textSignal] filter:^BOOL(NSString *text)
{ // 秘薦、鬟船Д奪して @strongify(self) return [self isValidText:text]; }] throttle:0.5] // 500ミリ昼參坪 flattenMap:^RACStream*(NSString *text) { // 秘薦、鬟稀`バ`に僕佚 @strongify(self) return [self signalForSendText:text]; }] flattenMap:^RACStream*(NSDictionary *jsonResponse) { // レスポンスの、鯤垢辰瀞拔肇稀`バ`からデ`タ函誼 @strongify(self) return [self signalForResult:jsonResponse[@"result"]] }] deliverOn:[RACScheduler mainThreadScheduler]] // UIスレッドで subscribeNext:^(NSDictionary *jsonRespoonse) { // UIを厚仟 } error:^(NSError *error) { NSLog(@"An error occurred: %@", error); }];
21.
FRP GUI UI Push
22.
GUI ON/OFF (Spinner/UIPickerView)
24.
Non-FRP UI
25.
FRP
26.
iOS Android Java Java8
(+ Retrolambda) Objective-C Groovy Swift
27.
THE END
Download