This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AggregateOperations.h | |
// AggregateOperationsPlayground | |
// | |
// Created by Xcode Developer on 9/22/22. | |
// | |
#ifndef AggregateOperations_h | |
#define AggregateOperations_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef const typeof(id(^)(void)) retained_object; | |
static id (^retainable_object)(id(^)(void)) = ^ id (id(^object)(void)) { | |
return ^{ | |
return object(); | |
}; | |
}; | |
typeof (retained_object) *(^(^retain_object)(id (^__strong)(void)))(void) = ^ (id(^retainable_object)(void)) { | |
typeof(retained_object) * object_address; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Clocking.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <time.h> | |
#define CONDITION(x) ((clock_t)nil ^ x) | |
#define DECREMENT(x) (x = ~-x) | |
#define ADJUST_TIME(x) x / CLOCKS_PER_SEC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef typeof(unsigned long (^ _Nonnull __strong (* _Nonnull))(unsigned long)) predicate_function_ptr; | |
struct predicate_functions_arr_struct | |
{ | |
unsigned long len; | |
predicate_function_ptr functions[]; | |
}; | |
static void(^test_flexible_array_member)(void) = ^{ | |
struct predicate_functions_arr_struct * p_functions = malloc(sizeof(struct predicate_functions_arr_struct) + (10 * sizeof(predicate_function_ptr))); | |
p_functions->len = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// PredicateFunctions.h | |
// PredicateFunctions | |
// | |
// Created by Xcode Developer on 9/10/22. | |
// | |
#ifndef PredicateFunctions_h | |
#define PredicateFunctions_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "SimpleBlockComposition.h" | |
typedef typeof(unsigned long(^)(unsigned long)) block; | |
typedef typeof(block *) block_t; | |
typedef typeof(block(^)(block)) block_object; | |
static block (^compose)(block, block) = ^ (block composition, block component) { | |
block temp_comp = composition; | |
block new_comp = ^ (unsigned long c) { printf("composing block chain...\n"); return component(temp_comp(c)); }; | |
return new_comp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef const bool (^ __strong object_block)(const bool); | |
object_block object_blk = ^ bool (const bool b) { | |
printf("object_blk state == %s\n", (b) ? "TRUE" : "FALSE"); | |
return b; | |
}; | |
object_block object_blk_2 = ^ bool (const bool b) { | |
printf("object_blk_2 state == %s\n", (b) ? "TRUE" : "FALSE"); | |
return b; | |
}; | |
object_block object_blk_3 = ^ bool (const bool b) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef const void (^ const __strong object_block)(const bool); | |
object_block object_blk = ^ (const bool b) { | |
printf("object_blk state == %s\n", (b) ? "TRUE" : "FALSE"); | |
}; | |
object_block object_blk_2 = ^ (const bool b) { | |
printf("object_blk_2 state == %s\n", (b) ? "TRUE" : "FALSE"); | |
}; | |
object_block object_blk_3 = ^ (const bool b) { | |
printf("object_blk_3 state == %s\n", (b) ? "TRUE" : "FALSE"); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void (^(^(^(^array_pointer_test)(const unsigned int))(CFTypeRef(^)(void)))(void(^)(CFTypeRef)))(CFTypeRef(^)(CFTypeRef)) = ^ (unsigned int object_count) { | |
typedef CFTypeRef objects[object_count]; | |
typeof(objects) objects_ptr[object_count]; | |
__block unsigned long (^recursive_block)(unsigned long); | |
(recursive_block = ^ unsigned long (unsigned long index) { | |
printf("index == %lu\n", index); | |
return (unsigned long)(index ^ 0UL) && (unsigned long)(recursive_block)(~-index); | |
})(object_count); | |
return ^ (CFTypeRef * objects_t) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__block unsigned long (^recursive_block)(unsigned long); | |
(recursive_block = ^ unsigned long (unsigned long index) { | |
printf("index == %lu\n", index); | |
return (unsigned long)(index ^ (unsigned long)(recursive_block)(~-index)); | |
})(10); |