3 ms·
No idea why the author thinks it's impossible. I mean, C stdlib comes with qsort. Here's a map in C void *map(void *in, void (*f)(void *src, void *dst), s
by okasaki 11y ago
No idea why the author thinks it's impossible. I mean, C stdlib comes with qsort.
Here's a map in C
void *map(void *in, void (*f)(void *src, void *dst), size_t size, size_t in_s, size_t out_s)
{
void *out = malloc(size * out_s);
for(size_t i = 0; i < size; i++)
f(in + (i * in_s), out + (i * out_s));
return out;
}