1 divert(-1)dnl -*- m4 -*-
2 # Usage: m4 [-Dfile=day04.input] day04.m4
4 include(`common.m4')ifelse(common(04), `ok', `',
5 `errprint(`Missing common initialization
8 define(`do', `ifelse($1, |, , `+(len($1)*index(`$*,', `,$1,')>0)$0(
10 define(`bump', `define(`$1', eval(defn(`$1')+$2))')
11 define(`_C', `bump(`part1', `(1<<$1)/2')bump(`part2', `$3')forloop($2,
12 eval($1+$2), `bump(`S'', `, $3)')')
13 define(`C', `ifelse($1,,`C(shift($@))',`_C(eval(do(shift($@))),$1,incr(
15 translit(include(defn(`file')), `a 'nl`:rd', `(,)')