トリッキーなコード その2
レス数が900を超えています。1000を超えると表示できなくなるよ。
0945デフォルトの名無しさん
2006/04/04(火) 21:15:26一レスに収まらないので分割で。
# define CAT_I(x, y) x ## y
# define CAT(x, y) CAT_I(x, y)
# define IF(c) CAT_I(IF_, c)
# define IF_true(t, _) t
# define IF_false(_, f) f
# define PREFIX_IF(c, p, b) IF(c)(CAT_I(p, b), b)
# define SEP(f, a) f a
/* トークン取得 */
# define TOK(ts) (CAT_I(TOK_, ts))
# define TOK_signed signed, false,
# define TOK_unsigned unsigned, false,
# define TOK_char char, false,
# define TOK_short short, false,
# define TOK_int int, false,
# define TOK_long long, false,
# define TOK_END !, true, !
# define IS_NIL(head, null, rest) null
# define HEAD(head, null, rest) head
# define TAIL(head, null, rest) TOK(rest)
# define FOLDR_0(list, f, z) IF(IS_NIL list)(z, f(HEAD list, FOLDR_1(TAIL list, f, z)))
# define FOLDR_1(list, f, z) IF(IS_NIL list)(z, f(HEAD list, FOLDR_2(TAIL list, f, z)))
# define FOLDR_2(list, f, z) IF(IS_NIL list)(z, f(HEAD list, FOLDR_3(TAIL list, f, z)))
# define FOLDR_3(list, f, z) IF(IS_NIL list)(z, f(HEAD list, z))
レス数が900を超えています。1000を超えると表示できなくなるよ。