chayleaf

chayleaf

@pavluk.org

sentient leaf they/she/acaofajmacoa/aaaaaaaaaaaaaaaa (you can go as weird as you want) biggest enemy of computers nixos user yuri scanlator this will do for now

6 followers41 following61 posts

for aoc2025 day 2, i went with python over apl def f(x): s=len(str(x)) n=s//2 p=10**n m=x//p m+=m<x%p if s%2:m=p return((m-1)*m*(p+1)-(110+10**(3*n))//111+1+(10**(2*n)-1)//11)//2 print(sum(f(b+1)-f(a)for a,b in (map(int,x.split('-'))for x in open('02.txt').read().strip().split(','))))

for aoc2025 day 2, i went with python over apl def f(x): s=len(str(x)) n=s//2 p=10**n m=x//p m+=m<x%p if s%2:m=p return((m-1)*m*(p+1)-(110+10**(3*n))//111+1+(10**(2*n)-1)//11)//2 print(sum(f(b+1)-f(a)for a,b in (map(int,x.split('-'))for x in open('02.txt').read().strip().split(','))))

funnily enough, this is almost shorter than my (ungolfed) apl solution: +/a[;2]-(a←{n←⌊(l←1+⌊10⍟⍵)÷2◊⌊((((((m-1)×m←m+((10*n)|⍵)>m←⌊⍵÷10*n)×1+10*n)-⌊(110+10*3×n)÷111) (((¯1+10*3×n)×110÷111)-10*n))[1+2|l]+1+⌊(¯1+10*2×n)÷11)÷2}¨⊃{(0 1)+⍎¨(⍵≠"-")⊂⍵}¨((x≠",")⊂x←(x≠"\n")/x←⎕FIO[26]"02.txt"))[;1]

got a highscore of a 26 move 15 puzzle solve on flipper zero which is only possible in one of 72.5k games. safe to say i'm not beating that one...

cursed idea: semantic whitespace for function application f g(h) -> apply f to g(h) f g (h) -> apply f g to h or even f g h -> apply f to g h

i hate that i see this and immediately go “oh yeah 13, 10, 9, 5, 8, 4, 3, 14, 10, 9, 5, 9, 4, 3, 8, 5, 6, 11, 12, 1, 2, 4, 3, 15, 4, 3, 15, 8, 15, 11, 12, 7, 6, 5, 11, 12, 7, 6, 5, 9, uuh i forgot”

it's okay i'm not completely gone yet only the first 28 moves are valid and then i misremember the board state, and also third move should be 6 instead of 9 in order to get an optimal solution

omg i just somehow ran into a situation where NullReferenceException was being thrown even after a null check??? sure c# whatever you say i'll just use a try catch...

currying may feel like a gimmick but when the argument you're passing is non-trivial (like the result of calling a function) they can actually give you performance savings for free (can be emulated by storing that result into a captured variable but that's much more boilerplate)

aoc day 1 a←⌽,⍉⊃{(⍎1↓⍵)×(1-2×⍵[1]="L")}¨((x≠"\n")⊂x←⎕FIO[26]"01.txt")◊z←0◊z←z+50=100|{z←z+50=100|⍵◊⍺+⍵}/a◊z can i go home please 🥺

shortened to just z←0◊z+50=100|{z←z+50=100|⍵◊⍺+⍵}/⌽{(⍎1↓⍵)×1-2×⍵[1]="L"}¨(x≠"\n")⊂x←⎕FIO[26]"01.txt"

continuing work on my lambda calculus+datalog graph reduction vm with incremental recomputation i swear i will make it the best langdev platform in the world 😈

it looked AI to me on first glance but also there's the gemini watermark in the bottom right which kinda gives it away...

Xe@xeiaso.net

Is this human authored or AI authored? Answer in quote posts.

today's minor update breakage: fish completions broke in home-manager and i had to hardcode the correct completions path waaaa why can't updates just work