diff options
Diffstat (limited to 'day7/maxima.mac')
-rw-r--r-- | day7/maxima.mac | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/day7/maxima.mac b/day7/maxima.mac deleted file mode 100644 index a1c2d18..0000000 --- a/day7/maxima.mac +++ /dev/null @@ -1,10 +0,0 @@ -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))); - |