<commit_before>struct pair;
struct comp_block;

enum block_type {
	BLOCK_NORMAL,
	BLOCK_COMP,
	BLOCK_QUOTE,
};

// Must match Codegen.hs
enum sum_side {
	SUM_LEFT,
	SUM_RIGHT,
};

union any {
	const struct pair *as_pair;
	union any (*as_block)(union any);
	const struct comp_block *as_comp_block;
	const union any *as_indirect;
	double as_num;
	long as_tagged;
};

typedef union any Any;

struct pair {
	const Any fst, snd;
};

typedef const struct pair *Pair;

typedef Any (*Block)(Any);

struct comp_block {
	const Any xy, yz;
};

typedef const struct comp_block *CompBlock;

extern const Any Unit;

#define CLEAR_TAG(v) ((Any) ((v).as_tagged &~ 0x3))
#define TAG(v, t) ((Any) (CLEAR_TAG(v).as_tagged | t))
#define GET_TAG(v) ((v).as_tagged & 0x3)

#define f(v) (((v).as_pair)->fst)
#define s(v) (((v).as_pair)->snd)

#define v0 f(v)
#define v1 f(s(v))
#define v2 f(s(s(v)))

#define vt1 s(v)
#define vt2 s(s(v))
#define vt3 s(s(s(v)))

#define list1(a, l) pair(a, l)
#define list2(a, b, l) pair(a, pair(b, l))
#define list3(a, b, c, l) pair(a, pair(b, pair(c, l)))

#define deref(v) (*(CLEAR_TAG(v).as_indirect))

#define s0 f(v)
#define s1 deref(s0)
#define s2 deref(s1)

#define EITHER(v, l, r) (GET_TAG(v) == SUM_LEFT) ? (l) : (r)
#define EITHER3(v1, v2, l, m, r) EITHER(v1, l, EITHER(v2, m, r))
#define EITHER4(v1, v2, v3, b0, b1, b2, b3) EITHER3(v1, v2, b0, b1, EITHER(v3, b2, b3))

Any pair(Any a, Any b);

#define OPFUNC(name) Any name(Any v)

#define OP(name, expr) OPFUNC(name) { return (expr); }
#define OP1(name, expr) OP(name, list1((expr), vt1))
#define OP21(name, expr) OP(name, list1((expr), vt2))

#define op(name) OPFUNC(name)
op(assocl);
op(assocr);
op(swap);
op(swapd);
op(intro1);
op(elim1);
op(copy);
op(drop);
Any applyBlock(Any b, Any x);
op(apply);
op(apply_tail);
op(compose);
op(quote);
op(introNum);
Any digit(int d, Any v);
op(add);
op(multiply);
op(inverse);
op(negate);
op(divmod);
op(assocls);
op(assocrs);
op(swaps);
op(swapds);
op(intro0);
op(elim0);
op(condapply);
op(distrib);
op(factor);
op(merge);
Any _assert(char *line, int size, Any v);
#define __stringify(line) #line
#define __str(line) __stringify(line)
#define _assert2(line, v) _assert(line, sizeof(line), v)
#define assert(v) _assert2("Line " __str(__LINE__), (v))
op(greater);
op(debug_print_raw);
op(debug_print_text);
#undef op
<commit_msg>Be more consistent about macro capitalisation<commit_after>struct pair;
struct comp_block;

enum block_type {
	BLOCK_NORMAL,
	BLOCK_COMP,
	BLOCK_QUOTE,
};

// Must match Codegen.hs
enum sum_side {
	SUM_LEFT,
	SUM_RIGHT,
};

union any {
	const struct pair *as_pair;
	union any (*as_block)(union any);
	const struct comp_block *as_comp_block;
	const union any *as_indirect;
	double as_num;
	long as_tagged;
};

typedef union any Any;

struct pair {
	const Any fst, snd;
};

typedef const struct pair *Pair;

typedef Any (*Block)(Any);

struct comp_block {
	const Any xy, yz;
};

typedef const struct comp_block *CompBlock;

extern const Any Unit;

#define CLEAR_TAG(v) ((Any) ((v).as_tagged &~ 0x3))
#define TAG(v, t) ((Any) (CLEAR_TAG(v).as_tagged | t))
#define GET_TAG(v) ((v).as_tagged & 0x3)

#define f(v) (((v).as_pair)->fst)
#define s(v) (((v).as_pair)->snd)

#define v0 f(v)
#define v1 f(s(v))
#define v2 f(s(s(v)))

#define vt1 s(v)
#define vt2 s(s(v))
#define vt3 s(s(s(v)))

#define list1(a, l) pair(a, l)
#define list2(a, b, l) pair(a, pair(b, l))
#define list3(a, b, c, l) pair(a, pair(b, pair(c, l)))

#define deref(v) (*(CLEAR_TAG(v).as_indirect))

#define s0 f(v)
#define s1 deref(s0)
#define s2 deref(s1)

#define EITHER(v, l, r) (GET_TAG(v) == SUM_LEFT) ? (l) : (r)
#define EITHER3(v1, v2, l, m, r) EITHER(v1, l, EITHER(v2, m, r))
#define EITHER4(v1, v2, v3, b0, b1, b2, b3) EITHER3(v1, v2, b0, b1, EITHER(v3, b2, b3))

Any pair(Any a, Any b);

#define OPFUNC(name) Any name(Any v)

#define OP(name, expr) OPFUNC(name) { return (expr); }
#define OP1(name, expr) OP(name, list1((expr), vt1))
#define OP21(name, expr) OP(name, list1((expr), vt2))

#define op(name) OPFUNC(name)
op(assocl);
op(assocr);
op(swap);
op(swapd);
op(intro1);
op(elim1);
op(copy);
op(drop);
Any applyBlock(Any b, Any x);
op(apply);
op(apply_tail);
op(compose);
op(quote);
op(introNum);
Any digit(int d, Any v);
op(add);
op(multiply);
op(inverse);
op(negate);
op(divmod);
op(assocls);
op(assocrs);
op(swaps);
op(swapds);
op(intro0);
op(elim0);
op(condapply);
op(distrib);
op(factor);
op(merge);
Any _assert(char *line, int size, Any v);
#define _STRINGIFY(line) #line
#define STRINGIFY(line) _STRINGIFY(line)
#define ASSERT(line, v) _assert(line, sizeof(line), v)
#define assert(v) ASSERT("Line " STRINGIFY(__LINE__) ": ", (v))
op(greater);
op(debug_print_raw);
op(debug_print_text);
#undef op

{'fraction_non_alphanumeric': 0.18738090196908744, 'fraction_numerical': 0.02159644293881008, 'mean_word_length': 5.846376811594203, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3970658', 'n_tokens_mistral': 2172, 'n_tokens_neox': 2117, 'n_words': 555}