summaryrefslogtreecommitdiff
path: root/functional.h
diff options
context:
space:
mode:
Diffstat (limited to 'functional.h')
-rw-r--r--functional.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/functional.h b/functional.h
new file mode 100644
index 0000000..fe7a869
--- /dev/null
+++ b/functional.h
@@ -0,0 +1,32 @@
+#ifndef FUNCTIONAL_H
+#define FUNCTIONAL_H
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+typedef struct {
+ int i;
+ int offset;
+ int n;
+ void* arr;
+ void* ctxp;
+ void* storage;
+} FunctionalArgs;
+
+typedef struct {
+ bool (*filter)(FunctionalArgs* args);
+ void (*map)(FunctionalArgs* args);
+ void* (*derefInput)(int i, void* j); // callback used to deference arr[i]
+ void (*shiftLeft)(FunctionalArgs* f);
+ FunctionalArgs args;
+} Functional;
+
+void func_map(Functional* f);
+
+void func_filter(Functional* f);
+
+void* func_find(Functional* f);
+
+#endif