aboutsummaryrefslogtreecommitdiff
path: root/aoc2023/build/dev/erlang/gleam_community_maths
diff options
context:
space:
mode:
authorH.J <thechairman@thechairman.info>2024-10-09 11:35:09 -0400
committerH.J <thechairman@thechairman.info>2024-10-09 11:35:09 -0400
commit6156a9ef7be4012063a042aafb4e9b0d7eadde8e (patch)
tree5d990ded3baba51ca3934b51994285f7d5915c34 /aoc2023/build/dev/erlang/gleam_community_maths
parentef2ad0ee020b6754c230ae08f5979948b8db1350 (diff)
downloadgleam_aoc-6156a9ef7be4012063a042aafb4e9b0d7eadde8e.tar.gz
gleam_aoc-6156a9ef7be4012063a042aafb4e9b0d7eadde8e.zip
cleanup
Diffstat (limited to 'aoc2023/build/dev/erlang/gleam_community_maths')
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam@@compile.erl157
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@arithmetics.cachebin14592 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@arithmetics.cache_metabin183 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@arithmetics.erl172
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@combinatorics.cachebin8261 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@combinatorics.cache_metabin64 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@combinatorics.erl218
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@conversion.cachebin4617 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@conversion.cache_metabin46 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@conversion.erl24
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@elementary.cachebin31030 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@elementary.cache_metabin66 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@elementary.erl286
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@metrics.cachebin12151 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@metrics.cache_metabin284 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@metrics.erl281
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@piecewise.cachebin34263 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@piecewise.cache_metabin201 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@piecewise.erl563
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@predicates.cachebin8829 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@predicates.cache_metabin222 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@predicates.erl118
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@sequences.cachebin6512 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@sequences.cache_metabin166 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@sequences.erl202
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@special.cachebin3951 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@special.cache_metabin166 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@special.erl163
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/maths.mjs95
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@arithmetics.beambin7228 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@combinatorics.beambin7572 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@conversion.beambin1864 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@elementary.beambin9272 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@metrics.beambin9256 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@piecewise.beambin16456 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@predicates.beambin5532 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@sequences.beambin7032 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@special.beambin7588 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community_maths.app7
39 files changed, 0 insertions, 2286 deletions
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam@@compile.erl b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam@@compile.erl
deleted file mode 100644
index 543db88..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam@@compile.erl
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/usr/bin/env escript
-
-% TODO: Don't concurrently print warnings and errors
-% TODO: Some tests
-
--record(arguments, {lib = "./", out = "./", modules = []}).
-
-main(Args) ->
- #arguments{out = Out, lib = Lib, modules = Modules} = parse(Args),
- IsElixirModule = fun(Module) ->
- filename:extension(Module) =:= ".ex"
- end,
- {ElixirModules, ErlangModules} = lists:partition(IsElixirModule, Modules),
- ok = configure_logging(),
- ok = add_lib_to_erlang_path(Lib),
- ok = filelib:ensure_dir([Out, $/]),
- {ErlangOk, _ErlangBeams} = compile_erlang(ErlangModules, Out),
- {ElixirOk, _ElixirBeams} = case ErlangOk of
- true -> compile_elixir(ElixirModules, Out);
- false -> {false, []}
- end,
- case ErlangOk and ElixirOk of
- true -> ok;
- false -> erlang:halt(1)
- end.
-
-compile_erlang(Modules, Out) ->
- Workers = start_compiler_workers(Out),
- ok = producer_loop(Modules, Workers),
- collect_results({true, []}).
-
-collect_results(Acc = {Result, Beams}) ->
- receive
- {compiled, Beam} -> collect_results({Result, [Beam | Beams]});
- failed -> collect_results({false, Beams})
- after 0 -> Acc
- end.
-
-producer_loop([], 0) ->
- ok;
-producer_loop([], Workers) ->
- receive
- {work_please, _} -> producer_loop([], Workers - 1)
- end;
-producer_loop([Module | Modules], Workers) ->
- receive
- {work_please, Worker} ->
- erlang:send(Worker, {module, Module}),
- producer_loop(Modules, Workers)
- end.
-
-start_compiler_workers(Out) ->
- Parent = self(),
- NumSchedulers = erlang:system_info(schedulers),
- SpawnWorker = fun(_) ->
- erlang:spawn_link(fun() -> worker_loop(Parent, Out) end)
- end,
- lists:foreach(SpawnWorker, lists:seq(1, NumSchedulers)),
- NumSchedulers.
-
-worker_loop(Parent, Out) ->
- Options = [report_errors, report_warnings, debug_info, {outdir, Out}],
- erlang:send(Parent, {work_please, self()}),
- receive
- {module, Module} ->
- log({compiling, Module}),
- case compile:file(Module, Options) of
- {ok, ModuleName} ->
- Beam = filename:join(Out, ModuleName) ++ ".beam",
- Message = {compiled, Beam},
- log(Message),
- erlang:send(Parent, Message);
- error ->
- log({failed, Module}),
- erlang:send(Parent, failed)
- end,
- worker_loop(Parent, Out)
- end.
-
-compile_elixir(Modules, Out) ->
- Error = [
- "The program elixir was not found. Is it installed?",
- $\n,
- "Documentation for installing Elixir can be viewed here:",
- $\n,
- "https://elixir-lang.org/install.html"
- ],
- case Modules of
- [] -> {true, []};
- _ ->
- log({starting, "compiler.app"}),
- ok = application:start(compiler),
- log({starting, "elixir.app"}),
- case application:start(elixir) of
- ok -> do_compile_elixir(Modules, Out);
- _ ->
- io:put_chars(standard_error, [Error, $\n]),
- {false, []}
- end
- end.
-
-do_compile_elixir(Modules, Out) ->
- ModuleBins = lists:map(fun(Module) ->
- log({compiling, Module}),
- list_to_binary(Module)
- end, Modules),
- OutBin = list_to_binary(Out),
- Options = [{dest, OutBin}],
- % Silence "redefining module" warnings.
- % Compiled modules in the build directory are added to the code path.
- % These warnings result from recompiling loaded modules.
- % TODO: This line can likely be removed if/when the build directory is cleaned before every compilation.
- 'Elixir.Code':compiler_options([{ignore_module_conflict, true}]),
- case 'Elixir.Kernel.ParallelCompiler':compile_to_path(ModuleBins, OutBin, Options) of
- {ok, ModuleAtoms, _} ->
- ToBeam = fun(ModuleAtom) ->
- Beam = filename:join(Out, atom_to_list(ModuleAtom)) ++ ".beam",
- log({compiled, Beam}),
- Beam
- end,
- {true, lists:map(ToBeam, ModuleAtoms)};
- {error, Errors, _} ->
- % Log all filenames associated with modules that failed to compile.
- % Note: The compiler prints compilation errors upon encountering them.
- ErrorFiles = lists:usort([File || {File, _, _} <- Errors]),
- Log = fun(File) ->
- log({failed, binary_to_list(File)})
- end,
- lists:foreach(Log, ErrorFiles),
- {false, []};
- _ -> {false, []}
- end.
-
-add_lib_to_erlang_path(Lib) ->
- code:add_paths(filelib:wildcard([Lib, "/*/ebin"])).
-
-parse(Args) ->
- parse(Args, #arguments{}).
-
-parse([], Arguments) ->
- Arguments;
-parse(["--lib", Lib | Rest], Arguments) ->
- parse(Rest, Arguments#arguments{lib = Lib});
-parse(["--out", Out | Rest], Arguments) ->
- parse(Rest, Arguments#arguments{out = Out});
-parse([Module | Rest], Arguments = #arguments{modules = Modules}) ->
- parse(Rest, Arguments#arguments{modules = [Module | Modules]}).
-
-configure_logging() ->
- Enabled = os:getenv("GLEAM_LOG") /= false,
- persistent_term:put(gleam_logging_enabled, Enabled).
-
-log(Term) ->
- case persistent_term:get(gleam_logging_enabled) of
- true -> erlang:display(Term), ok;
- false -> ok
- end.
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@arithmetics.cache b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@arithmetics.cache
deleted file mode 100644
index b683c40..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@arithmetics.cache
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@arithmetics.cache_meta b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@arithmetics.cache_meta
deleted file mode 100644
index 23d4726..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@arithmetics.cache_meta
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@arithmetics.erl b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@arithmetics.erl
deleted file mode 100644
index b45f48e..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@arithmetics.erl
+++ /dev/null
@@ -1,172 +0,0 @@
--module(gleam_community@maths@arithmetics).
--compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-
--export([gcd/2, lcm/2, divisors/1, proper_divisors/1, float_sum/1, int_sum/1, float_product/1, int_product/1, float_cumulative_sum/1, int_cumulative_sum/1, float_cumumlative_product/1, int_cumulative_product/1]).
-
--spec do_gcd(integer(), integer()) -> integer().
-do_gcd(X, Y) ->
- case X =:= 0 of
- true ->
- Y;
-
- false ->
- _assert_subject = gleam@int:modulo(Y, X),
- {ok, Z} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/arithmetics"/utf8>>,
- function => <<"do_gcd"/utf8>>,
- line => 93})
- end,
- do_gcd(Z, X)
- end.
-
--spec gcd(integer(), integer()) -> integer().
-gcd(X, Y) ->
- Absx = gleam_community@maths@piecewise:int_absolute_value(X),
- Absy = gleam_community@maths@piecewise:int_absolute_value(Y),
- do_gcd(Absx, Absy).
-
--spec lcm(integer(), integer()) -> integer().
-lcm(X, Y) ->
- Absx = gleam_community@maths@piecewise:int_absolute_value(X),
- Absy = gleam_community@maths@piecewise:int_absolute_value(Y),
- case do_gcd(Absx, Absy) of
- 0 -> 0;
- Gleam@denominator -> Absx * Absy div Gleam@denominator
- end.
-
--spec find_divisors(integer()) -> list(integer()).
-find_divisors(N) ->
- Nabs = gleam_community@maths@piecewise:float_absolute_value(
- gleam_community@maths@conversion:int_to_float(N)
- ),
- _assert_subject = gleam_community@maths@elementary:square_root(Nabs),
- {ok, Sqrt_result} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/arithmetics"/utf8>>,
- function => <<"find_divisors"/utf8>>,
- line => 176})
- end,
- Max = gleam_community@maths@conversion:float_to_int(Sqrt_result) + 1,
- _pipe = gleam@list:range(2, Max),
- _pipe@1 = gleam@list:fold(_pipe, [1, N], fun(Acc, I) -> case (case I of
- 0 -> 0;
- Gleam@denominator -> N rem Gleam@denominator
- end) =:= 0 of
- true ->
- [I, case I of
- 0 -> 0;
- Gleam@denominator@1 -> N div Gleam@denominator@1
- end | Acc];
-
- false ->
- Acc
- end end),
- _pipe@2 = gleam@list:unique(_pipe@1),
- gleam@list:sort(_pipe@2, fun gleam@int:compare/2).
-
--spec divisors(integer()) -> list(integer()).
-divisors(N) ->
- find_divisors(N).
-
--spec proper_divisors(integer()) -> list(integer()).
-proper_divisors(N) ->
- Divisors = find_divisors(N),
- _pipe = Divisors,
- gleam@list:take(_pipe, gleam@list:length(Divisors) - 1).
-
--spec float_sum(list(float())) -> float().
-float_sum(Arr) ->
- case Arr of
- [] ->
- +0.0;
-
- _ ->
- _pipe = Arr,
- gleam@list:fold(_pipe, +0.0, fun(Acc, A) -> A + Acc end)
- end.
-
--spec int_sum(list(integer())) -> integer().
-int_sum(Arr) ->
- case Arr of
- [] ->
- 0;
-
- _ ->
- _pipe = Arr,
- gleam@list:fold(_pipe, 0, fun(Acc, A) -> A + Acc end)
- end.
-
--spec float_product(list(float())) -> float().
-float_product(Arr) ->
- case Arr of
- [] ->
- 1.0;
-
- _ ->
- _pipe = Arr,
- gleam@list:fold(_pipe, 1.0, fun(Acc, A) -> A * Acc end)
- end.
-
--spec int_product(list(integer())) -> integer().
-int_product(Arr) ->
- case Arr of
- [] ->
- 1;
-
- _ ->
- _pipe = Arr,
- gleam@list:fold(_pipe, 1, fun(Acc, A) -> A * Acc end)
- end.
-
--spec float_cumulative_sum(list(float())) -> list(float()).
-float_cumulative_sum(Arr) ->
- case Arr of
- [] ->
- [];
-
- _ ->
- _pipe = Arr,
- gleam@list:scan(_pipe, +0.0, fun(Acc, A) -> A + Acc end)
- end.
-
--spec int_cumulative_sum(list(integer())) -> list(integer()).
-int_cumulative_sum(Arr) ->
- case Arr of
- [] ->
- [];
-
- _ ->
- _pipe = Arr,
- gleam@list:scan(_pipe, 0, fun(Acc, A) -> A + Acc end)
- end.
-
--spec float_cumumlative_product(list(float())) -> list(float()).
-float_cumumlative_product(Arr) ->
- case Arr of
- [] ->
- [];
-
- _ ->
- _pipe = Arr,
- gleam@list:scan(_pipe, 1.0, fun(Acc, A) -> A * Acc end)
- end.
-
--spec int_cumulative_product(list(integer())) -> list(integer()).
-int_cumulative_product(Arr) ->
- case Arr of
- [] ->
- [];
-
- _ ->
- _pipe = Arr,
- gleam@list:scan(_pipe, 1, fun(Acc, A) -> A * Acc end)
- end.
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@combinatorics.cache b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@combinatorics.cache
deleted file mode 100644
index e95a3b0..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@combinatorics.cache
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@combinatorics.cache_meta b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@combinatorics.cache_meta
deleted file mode 100644
index f8262ee..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@combinatorics.cache_meta
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@combinatorics.erl b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@combinatorics.erl
deleted file mode 100644
index 00130c0..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@combinatorics.erl
+++ /dev/null
@@ -1,218 +0,0 @@
--module(gleam_community@maths@combinatorics).
--compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-
--export([combination/2, factorial/1, permutation/2, list_combination/2, list_permutation/1, cartesian_product/2]).
-
--spec combination(integer(), integer()) -> {ok, integer()} | {error, binary()}.
-combination(N, K) ->
- case N < 0 of
- true ->
- _pipe = <<"Invalid input argument: n < 0. Valid input is n > 0."/utf8>>,
- {error, _pipe};
-
- false ->
- case (K < 0) orelse (K > N) of
- true ->
- _pipe@1 = 0,
- {ok, _pipe@1};
-
- false ->
- case (K =:= 0) orelse (K =:= N) of
- true ->
- _pipe@2 = 1,
- {ok, _pipe@2};
-
- false ->
- Min = case K < (N - K) of
- true ->
- K;
-
- false ->
- N - K
- end,
- _pipe@3 = gleam@list:range(1, Min),
- _pipe@4 = gleam@list:fold(
- _pipe@3,
- 1,
- fun(Acc, X) -> case X of
- 0 -> 0;
- Gleam@denominator -> Acc * ((N + 1) - X)
- div Gleam@denominator
- end end
- ),
- {ok, _pipe@4}
- end
- end
- end.
-
--spec factorial(integer()) -> {ok, integer()} | {error, binary()}.
-factorial(N) ->
- case N < 0 of
- true ->
- _pipe = <<"Invalid input argument: n < 0. Valid input is n > 0."/utf8>>,
- {error, _pipe};
-
- false ->
- case N of
- 0 ->
- _pipe@1 = 1,
- {ok, _pipe@1};
-
- 1 ->
- _pipe@2 = 1,
- {ok, _pipe@2};
-
- _ ->
- _pipe@3 = gleam@list:range(1, N),
- _pipe@4 = gleam@list:fold(
- _pipe@3,
- 1,
- fun(Acc, X) -> Acc * X end
- ),
- {ok, _pipe@4}
- end
- end.
-
--spec permutation(integer(), integer()) -> {ok, integer()} | {error, binary()}.
-permutation(N, K) ->
- case N < 0 of
- true ->
- _pipe = <<"Invalid input argument: n < 0. Valid input is n > 0."/utf8>>,
- {error, _pipe};
-
- false ->
- case (K < 0) orelse (K > N) of
- true ->
- _pipe@1 = 0,
- {ok, _pipe@1};
-
- false ->
- case K =:= N of
- true ->
- _pipe@2 = 1,
- {ok, _pipe@2};
-
- false ->
- _assert_subject = factorial(N),
- {ok, V1} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/combinatorics"/utf8>>,
- function => <<"permutation"/utf8>>,
- line => 241})
- end,
- _assert_subject@1 = factorial(N - K),
- {ok, V2} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/maths/combinatorics"/utf8>>,
- function => <<"permutation"/utf8>>,
- line => 242})
- end,
- _pipe@3 = case V2 of
- 0 -> 0;
- Gleam@denominator -> V1 div Gleam@denominator
- end,
- {ok, _pipe@3}
- end
- end
- end.
-
--spec do_list_combination(list(JGD), integer(), list(JGD)) -> list(list(JGD)).
-do_list_combination(Arr, K, Prefix) ->
- case K of
- 0 ->
- [gleam@list:reverse(Prefix)];
-
- _ ->
- case Arr of
- [] ->
- [];
-
- [X | Xs] ->
- With_x = do_list_combination(Xs, K - 1, [X | Prefix]),
- Without_x = do_list_combination(Xs, K, Prefix),
- gleam@list:append(With_x, Without_x)
- end
- end.
-
--spec list_combination(list(JFX), integer()) -> {ok, list(list(JFX))} |
- {error, binary()}.
-list_combination(Arr, K) ->
- case K < 0 of
- true ->
- _pipe = <<"Invalid input argument: k < 0. Valid input is k > 0."/utf8>>,
- {error, _pipe};
-
- false ->
- case K > gleam@list:length(Arr) of
- true ->
- _pipe@1 = <<"Invalid input argument: k > length(arr). Valid input is 0 < k <= length(arr)."/utf8>>,
- {error, _pipe@1};
-
- false ->
- _pipe@2 = do_list_combination(Arr, K, []),
- {ok, _pipe@2}
- end
- end.
-
--spec list_permutation(list(JGI)) -> list(list(JGI)).
-list_permutation(Arr) ->
- case Arr of
- [] ->
- [[]];
-
- _ ->
- gleam@list:flat_map(
- Arr,
- fun(X) ->
- _assert_subject = gleam@list:pop(Arr, fun(Y) -> X =:= Y end),
- {ok, {_, Remaining}} = case _assert_subject of
- {ok, {_, _}} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/combinatorics"/utf8>>,
- function => <<"list_permutation"/utf8>>,
- line => 373})
- end,
- gleam@list:map(
- list_permutation(Remaining),
- fun(Perm) -> [X | Perm] end
- )
- end
- )
- end.
-
--spec cartesian_product(list(JGM), list(JGM)) -> list({JGM, JGM}).
-cartesian_product(Xarr, Yarr) ->
- Xset = begin
- _pipe = Xarr,
- gleam@set:from_list(_pipe)
- end,
- Yset = begin
- _pipe@1 = Yarr,
- gleam@set:from_list(_pipe@1)
- end,
- _pipe@2 = Xset,
- _pipe@3 = gleam@set:fold(
- _pipe@2,
- gleam@set:new(),
- fun(Accumulator0, Member0) ->
- gleam@set:fold(
- Yset,
- Accumulator0,
- fun(Accumulator1, Member1) ->
- gleam@set:insert(Accumulator1, {Member0, Member1})
- end
- )
- end
- ),
- gleam@set:to_list(_pipe@3).
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@conversion.cache b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@conversion.cache
deleted file mode 100644
index 6b3ed43..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@conversion.cache
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@conversion.cache_meta b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@conversion.cache_meta
deleted file mode 100644
index 374a6fb..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@conversion.cache_meta
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@conversion.erl b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@conversion.erl
deleted file mode 100644
index 1e44006..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@conversion.erl
+++ /dev/null
@@ -1,24 +0,0 @@
--module(gleam_community@maths@conversion).
--compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-
--export([int_to_float/1, float_to_int/1, degrees_to_radians/1, radians_to_degrees/1]).
-
--spec int_to_float(integer()) -> float().
-int_to_float(X) ->
- gleam@int:to_float(X).
-
--spec float_to_int(float()) -> integer().
-float_to_int(X) ->
- erlang:trunc(X).
-
--spec degrees_to_radians(float()) -> float().
-degrees_to_radians(X) ->
- (X * math:pi()) / 180.0.
-
--spec radians_to_degrees(float()) -> float().
-radians_to_degrees(X) ->
- case math:pi() of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> X * 180.0 / Gleam@denominator
- end.
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@elementary.cache b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@elementary.cache
deleted file mode 100644
index 5dbff0c..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@elementary.cache
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@elementary.cache_meta b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@elementary.cache_meta
deleted file mode 100644
index 8a3590f..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@elementary.cache_meta
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@elementary.erl b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@elementary.erl
deleted file mode 100644
index 422021e..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@elementary.erl
+++ /dev/null
@@ -1,286 +0,0 @@
--module(gleam_community@maths@elementary).
--compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-
--export([acos/1, acosh/1, asin/1, asinh/1, atan/1, atan2/2, atanh/1, cos/1, cosh/1, sin/1, sinh/1, tan/1, tanh/1, exponential/1, natural_logarithm/1, logarithm_2/1, logarithm_10/1, logarithm/2, power/2, square_root/1, cube_root/1, nth_root/2, pi/0, tau/0, e/0]).
-
--spec acos(float()) -> {ok, float()} | {error, binary()}.
-acos(X) ->
- case (X >= -1.0) andalso (X =< 1.0) of
- true ->
- _pipe = math:acos(X),
- {ok, _pipe};
-
- false ->
- _pipe@1 = <<"Invalid input argument: x >= -1 or x <= 1. Valid input is -1. <= x <= 1."/utf8>>,
- {error, _pipe@1}
- end.
-
--spec acosh(float()) -> {ok, float()} | {error, binary()}.
-acosh(X) ->
- case X >= 1.0 of
- true ->
- _pipe = math:acosh(X),
- {ok, _pipe};
-
- false ->
- _pipe@1 = <<"Invalid input argument: x < 1. Valid input is x >= 1."/utf8>>,
- {error, _pipe@1}
- end.
-
--spec asin(float()) -> {ok, float()} | {error, binary()}.
-asin(X) ->
- case (X >= -1.0) andalso (X =< 1.0) of
- true ->
- _pipe = math:asin(X),
- {ok, _pipe};
-
- false ->
- _pipe@1 = <<"Invalid input argument: x >= -1 or x <= 1. Valid input is -1. <= x <= 1."/utf8>>,
- {error, _pipe@1}
- end.
-
--spec asinh(float()) -> float().
-asinh(X) ->
- math:asinh(X).
-
--spec atan(float()) -> float().
-atan(X) ->
- math:atan(X).
-
--spec atan2(float(), float()) -> float().
-atan2(Y, X) ->
- math:atan2(Y, X).
-
--spec atanh(float()) -> {ok, float()} | {error, binary()}.
-atanh(X) ->
- case (X > -1.0) andalso (X < 1.0) of
- true ->
- _pipe = math:atanh(X),
- {ok, _pipe};
-
- false ->
- _pipe@1 = <<"Invalid input argument: x > -1 or x < 1. Valid input is -1. < x < 1."/utf8>>,
- {error, _pipe@1}
- end.
-
--spec cos(float()) -> float().
-cos(X) ->
- math:cos(X).
-
--spec cosh(float()) -> float().
-cosh(X) ->
- math:cosh(X).
-
--spec sin(float()) -> float().
-sin(X) ->
- math:sin(X).
-
--spec sinh(float()) -> float().
-sinh(X) ->
- math:sinh(X).
-
--spec tan(float()) -> float().
-tan(X) ->
- math:tan(X).
-
--spec tanh(float()) -> float().
-tanh(X) ->
- math:tanh(X).
-
--spec exponential(float()) -> float().
-exponential(X) ->
- math:exp(X).
-
--spec natural_logarithm(float()) -> {ok, float()} | {error, binary()}.
-natural_logarithm(X) ->
- case X > +0.0 of
- true ->
- _pipe = math:log(X),
- {ok, _pipe};
-
- false ->
- _pipe@1 = <<"Invalid input argument: x <= 0. Valid input is x > 0."/utf8>>,
- {error, _pipe@1}
- end.
-
--spec logarithm_2(float()) -> {ok, float()} | {error, binary()}.
-logarithm_2(X) ->
- case X > +0.0 of
- true ->
- _pipe = math:log2(X),
- {ok, _pipe};
-
- false ->
- _pipe@1 = <<"Invalid input argument: x <= 0. Valid input is x > 0."/utf8>>,
- {error, _pipe@1}
- end.
-
--spec logarithm_10(float()) -> {ok, float()} | {error, binary()}.
-logarithm_10(X) ->
- case X > +0.0 of
- true ->
- _pipe = math:log10(X),
- {ok, _pipe};
-
- false ->
- _pipe@1 = <<"Invalid input argument: x <= 0. Valid input is x > 0."/utf8>>,
- {error, _pipe@1}
- end.
-
--spec logarithm(float(), gleam@option:option(float())) -> {ok, float()} |
- {error, binary()}.
-logarithm(X, Base) ->
- case X > +0.0 of
- true ->
- case Base of
- {some, A} ->
- case (A > +0.0) andalso (A /= 1.0) of
- true ->
- _assert_subject = logarithm_10(X),
- {ok, Numerator} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/elementary"/utf8>>,
- function => <<"logarithm"/utf8>>,
- line => 820})
- end,
- _assert_subject@1 = logarithm_10(A),
- {ok, Denominator} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/maths/elementary"/utf8>>,
- function => <<"logarithm"/utf8>>,
- line => 821})
- end,
- _pipe = case Denominator of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> Numerator / Gleam@denominator
- end,
- {ok, _pipe};
-
- false ->
- _pipe@1 = <<"Invalid input argument: base <= 0 or base == 1. Valid input is base > 0 and base != 1."/utf8>>,
- {error, _pipe@1}
- end;
-
- _ ->
- _pipe@2 = <<"Invalid input argument: base <= 0 or base == 1. Valid input is base > 0 and base != 1."/utf8>>,
- {error, _pipe@2}
- end;
-
- _ ->
- _pipe@3 = <<"Invalid input argument: x <= 0. Valid input is x > 0."/utf8>>,
- {error, _pipe@3}
- end.
-
--spec power(float(), float()) -> {ok, float()} | {error, binary()}.
-power(X, Y) ->
- Fractional = (math:ceil(Y) - Y) > +0.0,
- case ((X < +0.0) andalso Fractional) orelse ((X =:= +0.0) andalso (Y < +0.0)) of
- true ->
- _pipe = <<"Invalid input argument: x < 0 and y is fractional or x = 0 and y < 0."/utf8>>,
- {error, _pipe};
-
- false ->
- _pipe@1 = math:pow(X, Y),
- {ok, _pipe@1}
- end.
-
--spec square_root(float()) -> {ok, float()} | {error, binary()}.
-square_root(X) ->
- case X < +0.0 of
- true ->
- _pipe = <<"Invalid input argument: x < 0."/utf8>>,
- {error, _pipe};
-
- false ->
- _assert_subject = power(X, 1.0 / 2.0),
- {ok, Result} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/elementary"/utf8>>,
- function => <<"square_root"/utf8>>,
- line => 1066})
- end,
- _pipe@1 = Result,
- {ok, _pipe@1}
- end.
-
--spec cube_root(float()) -> {ok, float()} | {error, binary()}.
-cube_root(X) ->
- case X < +0.0 of
- true ->
- _pipe = <<"Invalid input argument: x < 0."/utf8>>,
- {error, _pipe};
-
- false ->
- _assert_subject = power(X, 1.0 / 3.0),
- {ok, Result} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/elementary"/utf8>>,
- function => <<"cube_root"/utf8>>,
- line => 1118})
- end,
- _pipe@1 = Result,
- {ok, _pipe@1}
- end.
-
--spec nth_root(float(), integer()) -> {ok, float()} | {error, binary()}.
-nth_root(X, N) ->
- case X < +0.0 of
- true ->
- _pipe = <<"Invalid input argument: x < 0. Valid input is x > 0"/utf8>>,
- {error, _pipe};
-
- false ->
- case N >= 1 of
- true ->
- _assert_subject = power(X, case gleam@int:to_float(N) of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> 1.0 / Gleam@denominator
- end),
- {ok, Result} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/elementary"/utf8>>,
- function => <<"nth_root"/utf8>>,
- line => 1175})
- end,
- _pipe@1 = Result,
- {ok, _pipe@1};
-
- false ->
- _pipe@2 = <<"Invalid input argument: n < 1. Valid input is n >= 2."/utf8>>,
- {error, _pipe@2}
- end
- end.
-
--spec pi() -> float().
-pi() ->
- math:pi().
-
--spec tau() -> float().
-tau() ->
- 2.0 * pi().
-
--spec e() -> float().
-e() ->
- exponential(1.0).
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@metrics.cache b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@metrics.cache
deleted file mode 100644
index 6dc087d..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@metrics.cache
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@metrics.cache_meta b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@metrics.cache_meta
deleted file mode 100644
index ad6a7f1..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@metrics.cache_meta
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@metrics.erl b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@metrics.erl
deleted file mode 100644
index 3483014..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@metrics.erl
+++ /dev/null
@@ -1,281 +0,0 @@
--module(gleam_community@maths@metrics).
--compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-
--export([norm/2, minkowski_distance/3, manhatten_distance/2, euclidean_distance/2, mean/1, median/1, variance/2, standard_deviation/2]).
-
--spec norm(list(float()), float()) -> float().
-norm(Arr, P) ->
- case Arr of
- [] ->
- +0.0;
-
- _ ->
- Agg = begin
- _pipe = Arr,
- gleam@list:fold(
- _pipe,
- +0.0,
- fun(Acc, A) ->
- _assert_subject = gleam_community@maths@elementary:power(
- gleam_community@maths@piecewise:float_absolute_value(
- A
- ),
- P
- ),
- {ok, Result} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/metrics"/utf8>>,
- function => <<"norm"/utf8>>,
- line => 101})
- end,
- Result + Acc
- end
- )
- end,
- _assert_subject@1 = gleam_community@maths@elementary:power(
- Agg,
- case P of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> 1.0 / Gleam@denominator
- end
- ),
- {ok, Result@1} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/maths/metrics"/utf8>>,
- function => <<"norm"/utf8>>,
- line => 106})
- end,
- Result@1
- end.
-
--spec minkowski_distance(list(float()), list(float()), float()) -> {ok, float()} |
- {error, binary()}.
-minkowski_distance(Xarr, Yarr, P) ->
- Xlen = gleam@list:length(Xarr),
- Ylen = gleam@list:length(Yarr),
- case Xlen =:= Ylen of
- false ->
- _pipe = <<"Invalid input argument: length(xarr) != length(yarr). Valid input is when length(xarr) == length(yarr)."/utf8>>,
- {error, _pipe};
-
- true ->
- case P < 1.0 of
- true ->
- _pipe@1 = <<"Invalid input argument: p < 1. Valid input is p >= 1."/utf8>>,
- {error, _pipe@1};
-
- false ->
- _pipe@2 = gleam@list:zip(Xarr, Yarr),
- _pipe@3 = gleam@list:map(
- _pipe@2,
- fun(Tuple) ->
- gleam@pair:first(Tuple) - gleam@pair:second(Tuple)
- end
- ),
- _pipe@4 = norm(_pipe@3, P),
- {ok, _pipe@4}
- end
- end.
-
--spec manhatten_distance(list(float()), list(float())) -> {ok, float()} |
- {error, binary()}.
-manhatten_distance(Xarr, Yarr) ->
- minkowski_distance(Xarr, Yarr, 1.0).
-
--spec euclidean_distance(list(float()), list(float())) -> {ok, float()} |
- {error, binary()}.
-euclidean_distance(Xarr, Yarr) ->
- minkowski_distance(Xarr, Yarr, 2.0).
-
--spec mean(list(float())) -> {ok, float()} | {error, binary()}.
-mean(Arr) ->
- case Arr of
- [] ->
- _pipe = <<"Invalid input argument: The list is empty."/utf8>>,
- {error, _pipe};
-
- _ ->
- _pipe@1 = Arr,
- _pipe@2 = gleam_community@maths@arithmetics:float_sum(_pipe@1),
- _pipe@3 = (fun(A) ->
- case gleam_community@maths@conversion:int_to_float(
- gleam@list:length(Arr)
- ) of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> A / Gleam@denominator
- end
- end)(_pipe@2),
- {ok, _pipe@3}
- end.
-
--spec median(list(float())) -> {ok, float()} | {error, binary()}.
-median(Arr) ->
- case Arr of
- [] ->
- _pipe = <<"Invalid input argument: The list is empty."/utf8>>,
- {error, _pipe};
-
- _ ->
- Count = gleam@list:length(Arr),
- Mid = gleam@list:length(Arr) div 2,
- Sorted = gleam@list:sort(Arr, fun gleam@float:compare/2),
- case gleam_community@maths@predicates:is_odd(Count) of
- true ->
- _assert_subject = gleam@list:at(Sorted, Mid),
- {ok, Val0} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/metrics"/utf8>>,
- function => <<"median"/utf8>>,
- line => 402})
- end,
- _pipe@1 = Val0,
- {ok, _pipe@1};
-
- false ->
- _assert_subject@1 = gleam@list:at(Sorted, Mid - 1),
- {ok, Val0@1} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/maths/metrics"/utf8>>,
- function => <<"median"/utf8>>,
- line => 409})
- end,
- _assert_subject@2 = gleam@list:at(Sorted, Mid),
- {ok, Val1} = case _assert_subject@2 of
- {ok, _} -> _assert_subject@2;
- _assert_fail@2 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@2,
- module => <<"gleam_community/maths/metrics"/utf8>>,
- function => <<"median"/utf8>>,
- line => 410})
- end,
- _pipe@2 = [Val0@1, Val1],
- mean(_pipe@2)
- end
- end.
-
--spec variance(list(float()), integer()) -> {ok, float()} | {error, binary()}.
-variance(Arr, Ddof) ->
- case Arr of
- [] ->
- _pipe = <<"Invalid input argument: The list is empty."/utf8>>,
- {error, _pipe};
-
- _ ->
- case Ddof < 0 of
- true ->
- _pipe@1 = <<"Invalid input argument: ddof < 0. Valid input is ddof >= 0."/utf8>>,
- {error, _pipe@1};
-
- false ->
- _assert_subject = mean(Arr),
- {ok, Mean} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/metrics"/utf8>>,
- function => <<"variance"/utf8>>,
- line => 475})
- end,
- _pipe@2 = Arr,
- _pipe@3 = gleam@list:map(
- _pipe@2,
- fun(A) ->
- _assert_subject@1 = gleam_community@maths@elementary:power(
- A - Mean,
- 2.0
- ),
- {ok, Result} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/maths/metrics"/utf8>>,
- function => <<"variance"/utf8>>,
- line => 478})
- end,
- Result
- end
- ),
- _pipe@4 = gleam_community@maths@arithmetics:float_sum(
- _pipe@3
- ),
- _pipe@5 = (fun(A@1) ->
- case (gleam_community@maths@conversion:int_to_float(
- gleam@list:length(Arr)
- )
- - gleam_community@maths@conversion:int_to_float(Ddof)) of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> A@1 / Gleam@denominator
- end
- end)(_pipe@4),
- {ok, _pipe@5}
- end
- end.
-
--spec standard_deviation(list(float()), integer()) -> {ok, float()} |
- {error, binary()}.
-standard_deviation(Arr, Ddof) ->
- case Arr of
- [] ->
- _pipe = <<"Invalid input argument: The list is empty."/utf8>>,
- {error, _pipe};
-
- _ ->
- case Ddof < 0 of
- true ->
- _pipe@1 = <<"Invalid input argument: ddof < 0. Valid input is ddof >= 0."/utf8>>,
- {error, _pipe@1};
-
- false ->
- _assert_subject = variance(Arr, Ddof),
- {ok, Variance} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/metrics"/utf8>>,
- function => <<"standard_deviation"/utf8>>,
- line => 551})
- end,
- _assert_subject@1 = gleam_community@maths@elementary:square_root(
- Variance
- ),
- {ok, Stdev} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/maths/metrics"/utf8>>,
- function => <<"standard_deviation"/utf8>>,
- line => 554})
- end,
- _pipe@2 = Stdev,
- {ok, _pipe@2}
- end
- end.
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@piecewise.cache b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@piecewise.cache
deleted file mode 100644
index d65054e..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@piecewise.cache
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@piecewise.cache_meta b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@piecewise.cache_meta
deleted file mode 100644
index 21c97d4..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@piecewise.cache_meta
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@piecewise.erl b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@piecewise.erl
deleted file mode 100644
index c724271..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@piecewise.erl
+++ /dev/null
@@ -1,563 +0,0 @@
--module(gleam_community@maths@piecewise).
--compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-
--export([float_absolute_value/1, int_absolute_value/1, float_absolute_difference/2, int_absolute_difference/2, float_sign/1, round/3, ceiling/2, floor/2, truncate/2, int_sign/1, float_flip_sign/1, float_copy_sign/2, int_flip_sign/1, int_copy_sign/2, minimum/3, maximum/3, minmax/3, list_minimum/2, list_maximum/2, arg_minimum/2, arg_maximum/2, extrema/2]).
--export_type([rounding_mode/0]).
-
--type rounding_mode() :: round_nearest |
- round_ties_away |
- round_ties_up |
- round_to_zero |
- round_down |
- round_up.
-
--spec truncate_float(float()) -> float().
-truncate_float(X) ->
- erlang:trunc(X).
-
--spec round_to_zero(float(), float()) -> float().
-round_to_zero(P, X) ->
- case P of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> truncate_float(X * P) / Gleam@denominator
- end.
-
--spec round_down(float(), float()) -> float().
-round_down(P, X) ->
- case P of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> math:floor(X * P) / Gleam@denominator
- end.
-
--spec round_up(float(), float()) -> float().
-round_up(P, X) ->
- case P of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> math:ceil(X * P) / Gleam@denominator
- end.
-
--spec float_absolute_value(float()) -> float().
-float_absolute_value(X) ->
- case X > +0.0 of
- true ->
- X;
-
- false ->
- -1.0 * X
- end.
-
--spec int_absolute_value(integer()) -> integer().
-int_absolute_value(X) ->
- case X > 0 of
- true ->
- X;
-
- false ->
- -1 * X
- end.
-
--spec float_absolute_difference(float(), float()) -> float().
-float_absolute_difference(A, B) ->
- _pipe = A - B,
- float_absolute_value(_pipe).
-
--spec int_absolute_difference(integer(), integer()) -> integer().
-int_absolute_difference(A, B) ->
- _pipe = A - B,
- int_absolute_value(_pipe).
-
--spec do_float_sign(float()) -> float().
-do_float_sign(X) ->
- case X < +0.0 of
- true ->
- -1.0;
-
- false ->
- case X =:= +0.0 of
- true ->
- +0.0;
-
- false ->
- 1.0
- end
- end.
-
--spec float_sign(float()) -> float().
-float_sign(X) ->
- do_float_sign(X).
-
--spec round_to_nearest(float(), float()) -> float().
-round_to_nearest(P, X) ->
- Xabs = float_absolute_value(X) * P,
- Xabs_truncated = truncate_float(Xabs),
- Remainder = Xabs - Xabs_truncated,
- case Remainder of
- _ when Remainder > 0.5 ->
- case P of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> float_sign(X) * truncate_float(Xabs + 1.0)
- / Gleam@denominator
- end;
-
- _ when Remainder =:= 0.5 ->
- _assert_subject = gleam@int:modulo(
- gleam_community@maths@conversion:float_to_int(Xabs),
- 2
- ),
- {ok, Is_even} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/piecewise"/utf8>>,
- function => <<"round_to_nearest"/utf8>>,
- line => 423})
- end,
- case Is_even =:= 0 of
- true ->
- case P of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator@1 -> float_sign(X) * Xabs_truncated / Gleam@denominator@1
- end;
-
- false ->
- case P of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator@2 -> float_sign(X) * truncate_float(
- Xabs + 1.0
- )
- / Gleam@denominator@2
- end
- end;
-
- _ ->
- case P of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator@3 -> float_sign(X) * Xabs_truncated / Gleam@denominator@3
- end
- end.
-
--spec round_ties_away(float(), float()) -> float().
-round_ties_away(P, X) ->
- Xabs = float_absolute_value(X) * P,
- Remainder = Xabs - truncate_float(Xabs),
- case Remainder of
- _ when Remainder >= 0.5 ->
- case P of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> float_sign(X) * truncate_float(Xabs + 1.0)
- / Gleam@denominator
- end;
-
- _ ->
- case P of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator@1 -> float_sign(X) * truncate_float(Xabs) / Gleam@denominator@1
- end
- end.
-
--spec round_ties_up(float(), float()) -> float().
-round_ties_up(P, X) ->
- Xabs = float_absolute_value(X) * P,
- Xabs_truncated = truncate_float(Xabs),
- Remainder = Xabs - Xabs_truncated,
- case Remainder of
- _ when (Remainder >= 0.5) andalso (X >= +0.0) ->
- case P of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> float_sign(X) * truncate_float(Xabs + 1.0)
- / Gleam@denominator
- end;
-
- _ ->
- case P of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator@1 -> float_sign(X) * Xabs_truncated / Gleam@denominator@1
- end
- end.
-
--spec do_round(float(), float(), gleam@option:option(rounding_mode())) -> {ok,
- float()} |
- {error, binary()}.
-do_round(P, X, Mode) ->
- case Mode of
- {some, round_nearest} ->
- _pipe = round_to_nearest(P, X),
- {ok, _pipe};
-
- {some, round_ties_away} ->
- _pipe@1 = round_ties_away(P, X),
- {ok, _pipe@1};
-
- {some, round_ties_up} ->
- _pipe@2 = round_ties_up(P, X),
- {ok, _pipe@2};
-
- {some, round_to_zero} ->
- _pipe@3 = round_to_zero(P, X),
- {ok, _pipe@3};
-
- {some, round_down} ->
- _pipe@4 = round_down(P, X),
- {ok, _pipe@4};
-
- {some, round_up} ->
- _pipe@5 = round_up(P, X),
- {ok, _pipe@5};
-
- none ->
- _pipe@6 = round_to_nearest(P, X),
- {ok, _pipe@6}
- end.
-
--spec round(
- float(),
- gleam@option:option(integer()),
- gleam@option:option(rounding_mode())
-) -> {ok, float()} | {error, binary()}.
-round(X, Digits, Mode) ->
- case Digits of
- {some, A} ->
- _assert_subject = gleam_community@maths@elementary:power(
- 10.0,
- gleam_community@maths@conversion:int_to_float(A)
- ),
- {ok, P} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/piecewise"/utf8>>,
- function => <<"round"/utf8>>,
- line => 366})
- end,
- do_round(P, X, Mode);
-
- none ->
- do_round(1.0, X, Mode)
- end.
-
--spec ceiling(float(), gleam@option:option(integer())) -> {ok, float()} |
- {error, binary()}.
-ceiling(X, Digits) ->
- round(X, Digits, {some, round_up}).
-
--spec floor(float(), gleam@option:option(integer())) -> {ok, float()} |
- {error, binary()}.
-floor(X, Digits) ->
- round(X, Digits, {some, round_down}).
-
--spec truncate(float(), gleam@option:option(integer())) -> {ok, float()} |
- {error, binary()}.
-truncate(X, Digits) ->
- round(X, Digits, {some, round_to_zero}).
-
--spec do_int_sign(integer()) -> integer().
-do_int_sign(X) ->
- case X < 0 of
- true ->
- -1;
-
- false ->
- case X =:= 0 of
- true ->
- 0;
-
- false ->
- 1
- end
- end.
-
--spec int_sign(integer()) -> integer().
-int_sign(X) ->
- do_int_sign(X).
-
--spec float_flip_sign(float()) -> float().
-float_flip_sign(X) ->
- -1.0 * X.
-
--spec float_copy_sign(float(), float()) -> float().
-float_copy_sign(X, Y) ->
- case float_sign(X) =:= float_sign(Y) of
- true ->
- X;
-
- false ->
- float_flip_sign(X)
- end.
-
--spec int_flip_sign(integer()) -> integer().
-int_flip_sign(X) ->
- -1 * X.
-
--spec int_copy_sign(integer(), integer()) -> integer().
-int_copy_sign(X, Y) ->
- case int_sign(X) =:= int_sign(Y) of
- true ->
- X;
-
- false ->
- int_flip_sign(X)
- end.
-
--spec minimum(IUU, IUU, fun((IUU, IUU) -> gleam@order:order())) -> IUU.
-minimum(X, Y, Compare) ->
- case Compare(X, Y) of
- lt ->
- X;
-
- eq ->
- X;
-
- gt ->
- Y
- end.
-
--spec maximum(IUV, IUV, fun((IUV, IUV) -> gleam@order:order())) -> IUV.
-maximum(X, Y, Compare) ->
- case Compare(X, Y) of
- lt ->
- Y;
-
- eq ->
- Y;
-
- gt ->
- X
- end.
-
--spec minmax(IUW, IUW, fun((IUW, IUW) -> gleam@order:order())) -> {IUW, IUW}.
-minmax(X, Y, Compare) ->
- {minimum(X, Y, Compare), maximum(X, Y, Compare)}.
-
--spec list_minimum(list(IUX), fun((IUX, IUX) -> gleam@order:order())) -> {ok,
- IUX} |
- {error, binary()}.
-list_minimum(Arr, Compare) ->
- case Arr of
- [] ->
- _pipe = <<"Invalid input argument: The list is empty."/utf8>>,
- {error, _pipe};
-
- _ ->
- _assert_subject = gleam@list:at(Arr, 0),
- {ok, Val0} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/piecewise"/utf8>>,
- function => <<"list_minimum"/utf8>>,
- line => 945})
- end,
- _pipe@1 = Arr,
- _pipe@2 = gleam@list:fold(
- _pipe@1,
- Val0,
- fun(Acc, Element) -> case Compare(Element, Acc) of
- lt ->
- Element;
-
- _ ->
- Acc
- end end
- ),
- {ok, _pipe@2}
- end.
-
--spec list_maximum(list(IVB), fun((IVB, IVB) -> gleam@order:order())) -> {ok,
- IVB} |
- {error, binary()}.
-list_maximum(Arr, Compare) ->
- case Arr of
- [] ->
- _pipe = <<"Invalid input argument: The list is empty."/utf8>>,
- {error, _pipe};
-
- _ ->
- _assert_subject = gleam@list:at(Arr, 0),
- {ok, Val0} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/piecewise"/utf8>>,
- function => <<"list_maximum"/utf8>>,
- line => 1004})
- end,
- _pipe@1 = Arr,
- _pipe@2 = gleam@list:fold(
- _pipe@1,
- Val0,
- fun(Acc, Element) -> case Compare(Acc, Element) of
- lt ->
- Element;
-
- _ ->
- Acc
- end end
- ),
- {ok, _pipe@2}
- end.
-
--spec arg_minimum(list(IVF), fun((IVF, IVF) -> gleam@order:order())) -> {ok,
- list(integer())} |
- {error, binary()}.
-arg_minimum(Arr, Compare) ->
- case Arr of
- [] ->
- _pipe = <<"Invalid input argument: The list is empty."/utf8>>,
- {error, _pipe};
-
- _ ->
- _assert_subject = begin
- _pipe@1 = Arr,
- list_minimum(_pipe@1, Compare)
- end,
- {ok, Min} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/piecewise"/utf8>>,
- function => <<"arg_minimum"/utf8>>,
- line => 1069})
- end,
- _pipe@2 = Arr,
- _pipe@3 = gleam@list:index_map(
- _pipe@2,
- fun(Index, Element) -> case Compare(Element, Min) of
- eq ->
- Index;
-
- _ ->
- -1
- end end
- ),
- _pipe@4 = gleam@list:filter(_pipe@3, fun(Index@1) -> case Index@1 of
- -1 ->
- false;
-
- _ ->
- true
- end end),
- {ok, _pipe@4}
- end.
-
--spec arg_maximum(list(IVK), fun((IVK, IVK) -> gleam@order:order())) -> {ok,
- list(integer())} |
- {error, binary()}.
-arg_maximum(Arr, Compare) ->
- case Arr of
- [] ->
- _pipe = <<"Invalid input argument: The list is empty."/utf8>>,
- {error, _pipe};
-
- _ ->
- _assert_subject = begin
- _pipe@1 = Arr,
- list_maximum(_pipe@1, Compare)
- end,
- {ok, Max} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/piecewise"/utf8>>,
- function => <<"arg_maximum"/utf8>>,
- line => 1139})
- end,
- _pipe@2 = Arr,
- _pipe@3 = gleam@list:index_map(
- _pipe@2,
- fun(Index, Element) -> case Compare(Element, Max) of
- eq ->
- Index;
-
- _ ->
- -1
- end end
- ),
- _pipe@4 = gleam@list:filter(_pipe@3, fun(Index@1) -> case Index@1 of
- -1 ->
- false;
-
- _ ->
- true
- end end),
- {ok, _pipe@4}
- end.
-
--spec extrema(list(IVP), fun((IVP, IVP) -> gleam@order:order())) -> {ok,
- {IVP, IVP}} |
- {error, binary()}.
-extrema(Arr, Compare) ->
- case Arr of
- [] ->
- _pipe = <<"Invalid input argument: The list is empty."/utf8>>,
- {error, _pipe};
-
- _ ->
- _assert_subject = gleam@list:at(Arr, 0),
- {ok, Val_max} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/piecewise"/utf8>>,
- function => <<"extrema"/utf8>>,
- line => 1209})
- end,
- _assert_subject@1 = gleam@list:at(Arr, 0),
- {ok, Val_min} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/maths/piecewise"/utf8>>,
- function => <<"extrema"/utf8>>,
- line => 1210})
- end,
- _pipe@1 = Arr,
- _pipe@2 = gleam@list:fold(
- _pipe@1,
- {Val_min, Val_max},
- fun(Acc, Element) ->
- First = gleam@pair:first(Acc),
- Second = gleam@pair:second(Acc),
- case {Compare(Element, First), Compare(Second, Element)} of
- {lt, lt} ->
- {Element, Element};
-
- {lt, _} ->
- {Element, Second};
-
- {_, lt} ->
- {First, Element};
-
- {_, _} ->
- {First, Second}
- end
- end
- ),
- {ok, _pipe@2}
- end.
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@predicates.cache b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@predicates.cache
deleted file mode 100644
index 0ef2e9b..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@predicates.cache
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@predicates.cache_meta b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@predicates.cache_meta
deleted file mode 100644
index 549041c..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@predicates.cache_meta
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@predicates.erl b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@predicates.erl
deleted file mode 100644
index 42484d5..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@predicates.erl
+++ /dev/null
@@ -1,118 +0,0 @@
--module(gleam_community@maths@predicates).
--compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-
--export([is_close/4, all_close/4, is_fractional/1, is_power/2, is_perfect/1, is_even/1, is_odd/1]).
-
--spec float_absolute_value(float()) -> float().
-float_absolute_value(X) ->
- case X > +0.0 of
- true ->
- X;
-
- false ->
- -1.0 * X
- end.
-
--spec float_absolute_difference(float(), float()) -> float().
-float_absolute_difference(A, B) ->
- _pipe = A - B,
- float_absolute_value(_pipe).
-
--spec is_close(float(), float(), float(), float()) -> boolean().
-is_close(A, B, Rtol, Atol) ->
- X = float_absolute_difference(A, B),
- Y = Atol + (Rtol * float_absolute_value(B)),
- case X =< Y of
- true ->
- true;
-
- false ->
- false
- end.
-
--spec all_close(list(float()), list(float()), float(), float()) -> {ok,
- list(boolean())} |
- {error, binary()}.
-all_close(Xarr, Yarr, Rtol, Atol) ->
- Xlen = gleam@list:length(Xarr),
- Ylen = gleam@list:length(Yarr),
- case Xlen =:= Ylen of
- false ->
- _pipe = <<"Invalid input argument: length(xarr) != length(yarr). Valid input is when length(xarr) == length(yarr)."/utf8>>,
- {error, _pipe};
-
- true ->
- _pipe@1 = gleam@list:zip(Xarr, Yarr),
- _pipe@2 = gleam@list:map(
- _pipe@1,
- fun(Z) ->
- is_close(
- gleam@pair:first(Z),
- gleam@pair:second(Z),
- Rtol,
- Atol
- )
- end
- ),
- {ok, _pipe@2}
- end.
-
--spec is_fractional(float()) -> boolean().
-is_fractional(X) ->
- (math:ceil(X) - X) > +0.0.
-
--spec is_power(integer(), integer()) -> boolean().
-is_power(X, Y) ->
- _assert_subject = gleam_community@maths@elementary:logarithm(
- gleam@int:to_float(X),
- {some, gleam@int:to_float(Y)}
- ),
- {ok, Value} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/predicates"/utf8>>,
- function => <<"is_power"/utf8>>,
- line => 241})
- end,
- _assert_subject@1 = gleam_community@maths@piecewise:truncate(
- Value,
- {some, 0}
- ),
- {ok, Truncated} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/maths/predicates"/utf8>>,
- function => <<"is_power"/utf8>>,
- line => 243})
- end,
- Rem = Value - Truncated,
- Rem =:= +0.0.
-
--spec do_sum(list(integer())) -> integer().
-do_sum(Arr) ->
- case Arr of
- [] ->
- 0;
-
- _ ->
- _pipe = Arr,
- gleam@list:fold(_pipe, 0, fun(Acc, A) -> A + Acc end)
- end.
-
--spec is_perfect(integer()) -> boolean().
-is_perfect(N) ->
- do_sum(gleam_community@maths@arithmetics:proper_divisors(N)) =:= N.
-
--spec is_even(integer()) -> boolean().
-is_even(X) ->
- (X rem 2) =:= 0.
-
--spec is_odd(integer()) -> boolean().
-is_odd(X) ->
- (X rem 2) /= 0.
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@sequences.cache b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@sequences.cache
deleted file mode 100644
index e06c185..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@sequences.cache
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@sequences.cache_meta b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@sequences.cache_meta
deleted file mode 100644
index 3a025a2..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@sequences.cache_meta
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@sequences.erl b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@sequences.erl
deleted file mode 100644
index 72de13c..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@sequences.erl
+++ /dev/null
@@ -1,202 +0,0 @@
--module(gleam_community@maths@sequences).
--compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-
--export([arange/3, linear_space/4, logarithmic_space/5, geometric_space/4]).
-
--spec arange(float(), float(), float()) -> list(float()).
-arange(Start, Stop, Step) ->
- case ((Start >= Stop) andalso (Step > +0.0)) orelse ((Start =< Stop) andalso (Step
- < +0.0)) of
- true ->
- [];
-
- false ->
- Direction = case Start =< Stop of
- true ->
- 1.0;
-
- false ->
- -1.0
- end,
- Step_abs = gleam_community@maths@piecewise:float_absolute_value(
- Step
- ),
- Num = case Step_abs of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> gleam_community@maths@piecewise:float_absolute_value(
- Start - Stop
- )
- / Gleam@denominator
- end,
- _pipe = gleam@list:range(
- 0,
- gleam_community@maths@conversion:float_to_int(Num) - 1
- ),
- gleam@list:map(
- _pipe,
- fun(I) ->
- Start + ((gleam_community@maths@conversion:int_to_float(I) * Step_abs)
- * Direction)
- end
- )
- end.
-
--spec linear_space(float(), float(), integer(), boolean()) -> {ok,
- list(float())} |
- {error, binary()}.
-linear_space(Start, Stop, Num, Endpoint) ->
- Direction = case Start =< Stop of
- true ->
- 1.0;
-
- false ->
- -1.0
- end,
- case Num > 0 of
- true ->
- case Endpoint of
- true ->
- Increment = case gleam_community@maths@conversion:int_to_float(
- Num - 1
- ) of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> gleam_community@maths@piecewise:float_absolute_value(
- Start - Stop
- )
- / Gleam@denominator
- end,
- _pipe = gleam@list:range(0, Num - 1),
- _pipe@1 = gleam@list:map(
- _pipe,
- fun(I) ->
- Start + ((gleam_community@maths@conversion:int_to_float(
- I
- )
- * Increment)
- * Direction)
- end
- ),
- {ok, _pipe@1};
-
- false ->
- Increment@1 = case gleam_community@maths@conversion:int_to_float(
- Num
- ) of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator@1 -> gleam_community@maths@piecewise:float_absolute_value(
- Start - Stop
- )
- / Gleam@denominator@1
- end,
- _pipe@2 = gleam@list:range(0, Num - 1),
- _pipe@3 = gleam@list:map(
- _pipe@2,
- fun(I@1) ->
- Start + ((gleam_community@maths@conversion:int_to_float(
- I@1
- )
- * Increment@1)
- * Direction)
- end
- ),
- {ok, _pipe@3}
- end;
-
- false ->
- _pipe@4 = <<"Invalid input: num < 0. Valid input is num > 0."/utf8>>,
- {error, _pipe@4}
- end.
-
--spec logarithmic_space(float(), float(), integer(), boolean(), float()) -> {ok,
- list(float())} |
- {error, binary()}.
-logarithmic_space(Start, Stop, Num, Endpoint, Base) ->
- case Num > 0 of
- true ->
- _assert_subject = linear_space(Start, Stop, Num, Endpoint),
- {ok, Linspace} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/sequences"/utf8>>,
- function => <<"logarithmic_space"/utf8>>,
- line => 221})
- end,
- _pipe = Linspace,
- _pipe@1 = gleam@list:map(
- _pipe,
- fun(I) ->
- _assert_subject@1 = gleam_community@maths@elementary:power(
- Base,
- I
- ),
- {ok, Result} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/maths/sequences"/utf8>>,
- function => <<"logarithmic_space"/utf8>>,
- line => 224})
- end,
- Result
- end
- ),
- {ok, _pipe@1};
-
- false ->
- _pipe@2 = <<"Invalid input: num < 0. Valid input is num > 0."/utf8>>,
- {error, _pipe@2}
- end.
-
--spec geometric_space(float(), float(), integer(), boolean()) -> {ok,
- list(float())} |
- {error, binary()}.
-geometric_space(Start, Stop, Num, Endpoint) ->
- case (Start =:= +0.0) orelse (Stop =:= +0.0) of
- true ->
- _pipe = <<""/utf8>>,
- {error, _pipe};
-
- false ->
- case Num > 0 of
- true ->
- _assert_subject = gleam_community@maths@elementary:logarithm_10(
- Start
- ),
- {ok, Log_start} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/sequences"/utf8>>,
- function => <<"geometric_space"/utf8>>,
- line => 293})
- end,
- _assert_subject@1 = gleam_community@maths@elementary:logarithm_10(
- Stop
- ),
- {ok, Log_stop} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/maths/sequences"/utf8>>,
- function => <<"geometric_space"/utf8>>,
- line => 294})
- end,
- logarithmic_space(Log_start, Log_stop, Num, Endpoint, 10.0);
-
- false ->
- _pipe@1 = <<"Invalid input: num < 0. Valid input is num > 0."/utf8>>,
- {error, _pipe@1}
- end
- end.
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@special.cache b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@special.cache
deleted file mode 100644
index 0fdbab2..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@special.cache
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@special.cache_meta b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@special.cache_meta
deleted file mode 100644
index 3c21994..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@special.cache_meta
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@special.erl b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@special.erl
deleted file mode 100644
index b1e9214..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/gleam_community@maths@special.erl
+++ /dev/null
@@ -1,163 +0,0 @@
--module(gleam_community@maths@special).
--compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-
--export([erf/1, incomplete_gamma/2, gamma/1, beta/2]).
-
--spec erf(float()) -> float().
-erf(X) ->
- _assert_subject = [0.254829592,
- -0.284496736,
- 1.421413741,
- -1.453152027,
- 1.061405429],
- [A1, A2, A3, A4, A5] = case _assert_subject of
- [_, _, _, _, _] -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/special"/utf8>>,
- function => <<"erf"/utf8>>,
- line => 79})
- end,
- P = 0.3275911,
- Sign = gleam_community@maths@piecewise:float_sign(X),
- X@1 = gleam_community@maths@piecewise:float_absolute_value(X),
- T = case (1.0 + (P * X@1)) of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> 1.0 / Gleam@denominator
- end,
- Y = 1.0 - ((((((((((A5 * T) + A4) * T) + A3) * T) + A2) * T) + A1) * T) * gleam_community@maths@elementary:exponential(
- (-1.0 * X@1) * X@1
- )),
- Sign * Y.
-
--spec incomplete_gamma_sum(float(), float(), float(), float(), float()) -> float().
-incomplete_gamma_sum(A, X, T, S, N) ->
- case T of
- +0.0 ->
- S;
-
- _ ->
- Ns = S + T,
- Nt = T * (case (A + N) of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> X / Gleam@denominator
- end),
- incomplete_gamma_sum(A, X, Nt, Ns, N + 1.0)
- end.
-
--spec incomplete_gamma(float(), float()) -> {ok, float()} | {error, binary()}.
-incomplete_gamma(A, X) ->
- case (A > +0.0) andalso (X >= +0.0) of
- true ->
- _assert_subject = gleam_community@maths@elementary:power(X, A),
- {ok, V} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/special"/utf8>>,
- function => <<"incomplete_gamma"/utf8>>,
- line => 173})
- end,
- _pipe = (V * gleam_community@maths@elementary:exponential(-1.0 * X))
- * incomplete_gamma_sum(A, X, case A of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> 1.0 / Gleam@denominator
- end, +0.0, 1.0),
- {ok, _pipe};
-
- false ->
- _pipe@1 = <<"Invlaid input argument: a <= 0 or x < 0. Valid input is a > 0 and x >= 0."/utf8>>,
- {error, _pipe@1}
- end.
-
--spec gamma_lanczos(float()) -> float().
-gamma_lanczos(X) ->
- case X < 0.5 of
- true ->
- case (gleam_community@maths@elementary:sin(
- gleam_community@maths@elementary:pi() * X
- )
- * gamma_lanczos(1.0 - X)) of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> gleam_community@maths@elementary:pi() / Gleam@denominator
- end;
-
- false ->
- Z = X - 1.0,
- X@1 = gleam@list:index_fold(
- [0.99999999999980993,
- 676.5203681218851,
- -1259.1392167224028,
- 771.32342877765313,
- -176.61502916214059,
- 12.507343278686905,
- -0.13857109526572012,
- 0.0000099843695780195716,
- 0.00000015056327351493116],
- +0.0,
- fun(Acc, V, Index) -> case Index > 0 of
- true ->
- Acc + (case (Z + gleam_community@maths@conversion:int_to_float(
- Index
- )) of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator@1 -> V / Gleam@denominator@1
- end);
-
- false ->
- V
- end end
- ),
- T = (Z + 7.0) + 0.5,
- _assert_subject = gleam_community@maths@elementary:power(
- 2.0 * gleam_community@maths@elementary:pi(),
- 0.5
- ),
- {ok, V1} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/maths/special"/utf8>>,
- function => <<"gamma_lanczos"/utf8>>,
- line => 146})
- end,
- _assert_subject@1 = gleam_community@maths@elementary:power(
- T,
- Z + 0.5
- ),
- {ok, V2} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/maths/special"/utf8>>,
- function => <<"gamma_lanczos"/utf8>>,
- line => 147})
- end,
- ((V1 * V2) * gleam_community@maths@elementary:exponential(-1.0 * T))
- * X@1
- end.
-
--spec gamma(float()) -> float().
-gamma(X) ->
- gamma_lanczos(X).
-
--spec beta(float(), float()) -> float().
-beta(X, Y) ->
- case gamma(X + Y) of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> gamma(X) * gamma(Y) / Gleam@denominator
- end.
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/maths.mjs b/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/maths.mjs
deleted file mode 100644
index 5c5ab31..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/_gleam_artefacts/maths.mjs
+++ /dev/null
@@ -1,95 +0,0 @@
-export function sin(float) {
- return Math.sin(float)
-}
-
-export function pi() {
- return Math.PI
-}
-
-export function acos(float) {
- return Math.acos(float)
-}
-
-export function acosh(float) {
- return Math.acosh(float)
-}
-
-export function asin(float) {
- return Math.asin(float)
-}
-
-export function asinh(float) {
- return Math.asinh(float)
-}
-
-export function atan(float) {
- return Math.atan(float)
-}
-
-export function tan(float) {
- return Math.tan(float)
-}
-
-export function atan2(floaty, floatx) {
- return Math.atan2(floaty, floatx)
-}
-
-export function atanh(float) {
- return Math.atanh(float)
-}
-
-export function cos(float) {
- return Math.cos(float)
-}
-
-export function cosh(float) {
- return Math.cosh(float)
-}
-
-export function exponential(float) {
- return Math.exp(float)
-}
-
-export function ceiling(float) {
- return Math.ceil(float)
-}
-
-export function floor(float) {
- return Math.floor(float)
-}
-
-export function power(base, exponent) {
- return Math.pow(base, exponent)
-}
-
-export function logarithm(float) {
- return Math.log(float)
-}
-
-export function logarithm_10(float) {
- return Math.log10(float)
-}
-
-export function logarithm_2(float) {
- return Math.log2(float)
-}
-
-export function sinh(float) {
- return Math.sinh(float)
-}
-
-export function tanh(float) {
- return Math.tanh(float)
-}
-
-export function sign(float) {
- return Math.sign(float)
-}
-
-export function truncate(float) {
- return Math.trunc(float)
-}
-
-export function to_int(float) {
- return Math.trunc(float)
-}
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@arithmetics.beam b/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@arithmetics.beam
deleted file mode 100644
index 7bdc600..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@arithmetics.beam
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@combinatorics.beam b/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@combinatorics.beam
deleted file mode 100644
index f9cdc85..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@combinatorics.beam
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@conversion.beam b/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@conversion.beam
deleted file mode 100644
index bc6d41e..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@conversion.beam
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@elementary.beam b/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@elementary.beam
deleted file mode 100644
index 9850c86..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@elementary.beam
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@metrics.beam b/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@metrics.beam
deleted file mode 100644
index 513efde..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@metrics.beam
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@piecewise.beam b/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@piecewise.beam
deleted file mode 100644
index 652b871..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@piecewise.beam
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@predicates.beam b/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@predicates.beam
deleted file mode 100644
index c6fa350..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@predicates.beam
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@sequences.beam b/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@sequences.beam
deleted file mode 100644
index 1039c56..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@sequences.beam
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@special.beam b/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@special.beam
deleted file mode 100644
index 21b9149..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community@maths@special.beam
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community_maths.app b/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community_maths.app
deleted file mode 100644
index b24eaf7..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_maths/ebin/gleam_community_maths.app
+++ /dev/null
@@ -1,7 +0,0 @@
-{application, gleam_community_maths, [
- {vsn, "1.0.1"},
- {applications, [gleam_stdlib]},
- {description, "A basic maths library"},
- {modules, []},
- {registered, []}
-]}.