From 0b3e007095b6c478b5c250ce01ca79a8e9533c50 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Tue, 7 Dec 2021 14:49:00 -0500 Subject: day7: fix file extension --- day7/maxima.mac | 10 ++++++++++ day7/maxima.mx | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 day7/maxima.mac delete mode 100644 day7/maxima.mx (limited to 'day7') diff --git a/day7/maxima.mac b/day7/maxima.mac new file mode 100644 index 0000000..a1c2d18 --- /dev/null +++ b/day7/maxima.mac @@ -0,0 +1,10 @@ +load("descriptive")$ +load("in.mac")$ /* Should define `input` list of numbers. */ + +calcfuel(pos, distmod) := + lreduce("+", map(lambda([n], distmod(abs(pos - n))), input))$ + +calcfuel(median(input), lambda([x],x)); +calcfuel(floor(mean(input)), lambda([x], (x*(x+1)/2))); +calcfuel(floor(mean(input)) + 1, lambda([x], (x*(x+1)/2))); + diff --git a/day7/maxima.mx b/day7/maxima.mx deleted file mode 100644 index 4625fdc..0000000 --- a/day7/maxima.mx +++ /dev/null @@ -1,10 +0,0 @@ -load("descriptive")$ -batchload("./in.mx")$ /* Should define `input` list of numbers. */ - -calcfuel(pos, distmod) := - lreduce("+", map(lambda([n], distmod(abs(pos - n))), input))$ - -calcfuel(median(input), lambda([x],x)); -calcfuel(floor(mean(input)), lambda([x], (x*(x+1)/2))); -calcfuel(floor(mean(input)) + 1, lambda([x], (x*(x+1)/2))); - -- cgit v1.2.3