Commit graph

37 commits

Author SHA1 Message Date
sterni
11abe4784c feat(sterni/aoc/2022): day07 BQN solution
Did not have the motivation to go back and improve things, so this is my
initial attempt.

Change-Id: I3e129523d8f6c03bfbe50351f78d56ec7254a2dc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7539
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-07 19:17:34 +00:00
sterni
17e0a74e7b refactor(sterni/aoc/2022/05): improve parsing a bit
By taking advantage of filling (ironically) we can avoid creating a spec
in an ugly way. Additionally we transpose before parsing which doesn't
really make all that much of a difference, though.

Change-Id: Ida593138654f8367d666447f2b62013e8ddff01e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7535
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-06 14:45:48 +00:00
sterni
efbac0813c feat(sterni/aoc/2022): day06 array solutions
Today's problem works very nicely thanks to window although the indexing
sadly is off by a constant amount from what we immediately get. I have a
feeling someone is going to demolish my 31 char k solution.

Change-Id: Ia90786ce2fe321235286a85c466decf7feb669ed
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7534
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-06 14:45:48 +00:00
sterni
3f2172556a refactor(sterni/aoc/2022/05): improve _ApplyCmd
* take advantage of block header for destructuring

* instead of ModestTake we can split the stack we are picking from into
  what we need to move and what to keep, saving us from having to repeat
  ourselves.

* remove some unnecessary parens

Change-Id: I1b81a93a27d14dcbb6bdd109e862a356f611aca9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7530
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-05 21:45:16 +00:00
sterni
736edce338 feat(sterni/aoc/2022): day05 BQN solution
First input that is genuinely fun to parse in BQN. There surely is a
nice trick for _ApplyCmd, but this works and I'm unable to think today.

Change-Id: Iefccc81f1c1db03f45e31aaf7a1703ac0f91306f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7529
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-05 18:58:30 +00:00
sterni
5a41c4c6aa feat(sterni/aoc/2022): day04 BQN solution
Very tired today, but seems like a decently tidy solution.

Change-Id: Id3055159ae99e9b91fcc4b9b41ec7fe5e9a1bc6a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7528
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-05 18:58:30 +00:00
sterni
674195f92b fix(sterni/aoc/2022/01): fix output format
Change-Id: I7e2e82faa70ded683765627ba35e6f237976363f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7526
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-05 01:01:00 +00:00
sterni
6a3826e4b7 feat(sterni/aoc/2022): day03 k solution
Change-Id: If31e7047fc0c286e3e40b23a13fb9c51297809af
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7525
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-05 01:01:00 +00:00
sterni
0251f56575 feat(sterni/aoc/2022): day03 solution
Change-Id: I0f23d4d6405779fe7e804eb8b9f407dc4de88760
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7502
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-03 15:50:31 +00:00
sterni
9fed61297a feat(sterni/aoc/2022): day02 k solution
Uses the same idea as the BQN solution, but is very concise.

Change-Id: I876208e5e86f28240f4a3384d16321fd92d077eb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7499
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-03 01:25:32 +00:00
sterni
c0e70de17a feat(sterni/aoc/2022): day02 solution
It seems to me that there must be some way to improve this further,
but I'm kind of out of time.

Change-Id: Icf3510b6c126345551125543aec70155b6eeff4e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7498
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-02 18:31:30 +00:00
sterni
7ffeb4f7f1 refactor(sterni/aoc/2022): use scan in BQN/k
We can actually use one and the same scan on the sorted list
to solve part 1 and 2 of the assignment.

Change-Id: I657a81bad6151ef4fe13239db88d2dbd2f9c29d8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7491
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-02 02:21:01 +00:00
sterni
7e122fdcbc feat(sterni/aoc/2022): day01 solutions
Bonus solution in k as I got sniped by leah2.

Change-Id: I806f5b2ac1388159a427bb239bfb1bb7aeb329d7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7490
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-01 23:50:32 +00:00
sterni
7b87b2ccbb feat(sterni/exercises/aoc/2022): add basic scaffolding
I currently plan doing BQN and Nix (where it is not too annoying,
respectively). All solutions can either be executed together in a
derivation using CBQN and Tvix (!!!) or executed individually (I'll do
one file per solution for BQN and an attribute set of solutions for Nix
in a single file).

Change-Id: I7cff2ea60d06ae0f586d07779f14f5edd8f87aae
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7489
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-12-01 23:50:32 +00:00
sterni
6abea467e2 chore(sterni/exercises/aoc): split out utils into a library of sorts
Change-Id: Id2bb764fcdcd4b345eed6a98e0d67fcb18fc1353
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7488
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-01 23:38:46 +00:00
Vincent Ambo
aa122cbae7 style: format entire depot with nixpkgs-fmt
This CL can be used to compare the style of nixpkgs-fmt against other
formatters (nixpkgs, alejandra).

Change-Id: I87c6abff6bcb546b02ead15ad0405f81e01b6d9e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4397
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: lukegb <lukegb@tvl.fyi>
Reviewed-by: wpcarro <wpcarro@gmail.com>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: cynthia <cynthia@tvl.fyi>
Reviewed-by: edef <edef@edef.eu>
Reviewed-by: eta <tvl@eta.st>
Reviewed-by: grfn <grfn@gws.fyi>
2022-01-31 16:11:53 +00:00
sterni
666a944c59 feat(sterni/aoc/2021): day 10 solution
Change-Id: I5feb7187bd9aee45478aa5759e94df49e92565bf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4734
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-28 16:42:41 +00:00
sterni
dea67c9d78 feat(sterni/aoc/2021): day 11 solution
Change-Id: I59087cd855953d0ebdcaaea2374788e9e015e1ea
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4733
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-28 16:42:41 +00:00
sterni
d052bc5953 feat(sterni/aoc/2021): day 4 solution
Change-Id: Ib8b4206b40acad32e10ebd9103e54074ba3452fc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4681
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2021-12-26 19:51:25 +00:00
sterni
675f97e535 feat(sterni/aoc/2021): don't split on consecutive occurrences of 𝕨
Change-Id: I2ab17e0238df297f580c45bc28914c6dfd0ce848
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4680
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2021-12-26 19:51:24 +00:00
sterni
798b439c4b feat(sterni/aoc/25): day 25 part 1 solution
Change-Id: I8ffefd2b85e595bdae2cfb2bf7b34ea63b82c457
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4627
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2021-12-25 23:21:04 +00:00
sterni
d44b57b641 feat(sterni/aoc/2021): day 20 solution
Change-Id: Id864d6e6f0722c2da5d3487bd38da80e6bff2161
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4566
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-25 11:18:11 +00:00
sterni
4fbb2a1658 feat(sterni/aoc/2021): day 6 solution
Change-Id: Icd21b0f0c92b596fbb369d6f08715a6554259572
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4558
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-25 10:46:51 +00:00
sterni
01f4212ca1 feat(sterni/aoc/2021): day 15 solution
Change-Id: Idca2ae2829a7ee9e856aa7fcdc716c3055051062
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4363
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2021-12-16 12:43:46 +00:00
sterni
0357dd973b chore(sterni/aoc/2021): add shell for running solutions.bqn
Change-Id: I2e192dec9eb863a1b2386d40d26eeeeb57e1ed28
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4350
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-16 09:19:01 +00:00
sterni
b5678cbd5f feat(sterni/aoc/2021): day 14 solution
Change-Id: I8b6c0c5d1ced89eadaeea3fb619d37e77a439965
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4349
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-15 23:58:17 +00:00
sterni
3f8c99f5c3 refactor(sterni/aoc/2021): fold over 2d array instead of nested list
Seems to save some allocations and thus recover some performance
compared to the two separate folds we had before.

Change-Id: Ie3d283103e6a9b8aa702db633d9c988fda1b2903
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4348
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-12-15 23:58:17 +00:00
sterni
c7ebb34f8f refactor(sterni/aoc/2021): use a fold instead of last scan element
We can use the reverse swap trick to get a forward fold.

Change-Id: I88185e2ff0b41ec1454f414db2d24b1c8173ac2d
2021-12-14 13:41:01 +00:00
sterni
b5eb90196e refactor(sterni/aoc/2021): determine width/height in the same fold
Change-Id: I39410171402cedc3ee8d9ac972557656ed12de53
2021-12-14 00:56:31 +01:00
sterni
1303f3fc71 feat(sterni/aoc/2021): day 13 solution
Change-Id: I9cfa8a28854cbee7e8e1b457faf9c572353e803f
2021-12-13 23:39:50 +00:00
sterni
7a1a8aa3aa refactor(sterni/aoc/2021): name input data more consistently
Change-Id: Ibcea43d2e51f14d8b1b021050310f88d44d970d3
2021-12-13 23:39:49 +00:00
sterni
464bbcb15c feat(sterni/aoc/2021): day 9 solution
Change-Id: I90e7a47d5418abeff1ae7cc5757b6a8b3b0d1086
2021-12-13 22:13:29 +01:00
sterni
343b811bbc feat(sterni/aoc/2021): day 7 solution
Change-Id: I8c8b535defb42f15eafc816ebe953e51b11ea702
2021-12-13 21:58:15 +01:00
sterni
f78a7467f1 feat(sterni/aoc/2021): day 3 solution
Change-Id: Id14281f7b18ddaf6875e5dd8398249a10a9474af
2021-12-13 21:58:15 +01:00
sterni
b3d4305700 refactor(sterni/aoc/2021): allow variable bases ≤ 10 for ReadInt
Change-Id: Ie035134a4b3d478ce836aa00016122e0f49a5a28
2021-12-13 21:58:15 +01:00
sterni
4b38ba2d0a feat(sterni/aoc/2021): day 2 "solution"
Change-Id: Ifbd50274f0b09305991a49e7453ac1f13089e57e
2021-12-13 21:58:15 +01:00
sterni
9472bb6b04 feat(sterni/aoc/2021): day 1 solution
Change-Id: I0781b2aa3624df9a3158296edcbbbf2ee845102b
2021-12-01 18:17:29 +00:00