NSDictionary+OCTotallyLazy.h 554 B

1234567891011121314151617
  1. #import <Foundation/Foundation.h>
  2. #import "Option.h"
  3. #import "Sequence.h"
  4. @interface NSDictionary (Functional)
  5. -(NSDictionary *)filterKeys:(BOOL (^)(id))functorBlock;
  6. -(NSDictionary *)filterValues:(BOOL (^)(id))functorBlock;
  7. - (void)foreach:(void (^)(id, id))funcBlock;
  8. - (id)map:(NSArray * (^)(id, id))funcBlock;
  9. - (id)mapValues:(id (^)(id))funcBlock;
  10. -(Option *)optionForKey:(id)key;
  11. @end
  12. static NSDictionary *dictionary(Sequence * keys, Sequence * values) {
  13. return [NSDictionary dictionaryWithObjects:[values asArray] forKeys:[keys asArray]];
  14. }