deput / RWFunctor

Objective-C samples for Function Programing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RWFunctor

Objective-C samples for Functional Programing

  • samples
[[Functor of:@1] map:^id(id x) {
    return @([x integerValue] + 1);
}];//Functor(@2)

[[Functor of:@"abcd"] map:^id(id x) {
    return [x uppercaseString];
}];//Functor(@"ABCD")


[[Maybe of:nil] map:^id(id x) {
  return @([x integerValue] + 1);
}];//Functor(nil)

[[Either of:@1 :nil] map:^id(id x) {
    return @([x integerValue] + 1);
}];//Functor(2,nil)

func f = ^id(id x) {
  return @([x integerValue] + 1);
};
[[Ap of:f] ap:[Functor of:@1]];//Functor(2)

About

Objective-C samples for Function Programing

License:MIT License


Languages

Language:Objective-C 100.0%