summaryrefslogtreecommitdiff
path: root/functional.h
blob: fe7a869a8bf5a4e52439b6e6fb8f54b23704a0bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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