Skip to content

Instantly share code, notes, and snippets.

View LennyPhoenix's full-sized avatar

Lenny Critchley LennyPhoenix

View GitHub Profile
@andrewjpritchard
andrewjpritchard / fizzBuzz.ts
Last active May 16, 2022 19:50
FizzBuzz implementation using nothing but closures
type Fix<A> = (arg: Fix<A>) => A
type Unit = <T>(
unit: () => T
) => T;
type Bool = <T>(
$true: () => T,
$false: () => T,
) => T;
@jdah
jdah / macro_explanation.c
Created January 31, 2024 14:21
explaining some C macro magic
// so a cool trick with macros in C (and C++) is that since macros inside of
// macros are stille evaluated by the preprocessor, you can use macro names as
// parameters to other macros (and even construct macro names out of out of
// parameters!) - so using this trick if we have some macro like
// this:
#include <stddef.h>
#define MY_TYPES_ITER(_F, ...) \
_F(FOO, foo, 0, __VA_ARGS__) \