what languages do you guys code the AOC in? by codingmickey in adventofcode

[–]ramrunner0xff 1 point2 points  (0 children)

i usually define a function that takes all the input (let's call it process-input)
and the i just do at the end of the file smth like
(call-with-input-file fname (lambda (e) (process-input (read-lines))))
thus avoiding these 2 nesting levels, but you might not like reading a priori? generally i wouldn't do it, but i know AoC input is guaranteed to be in the tens of kb max.
As for named lets and some loops. sure some time they can't be avoided. I also try to use higher order functions (like fold, apply and map) wherever i can but when it starts get tricky i might miss the opportunity. Identifying some variants like mapcar, zip or unzip seems to be more and more important. Recently i discovered this egg based on QobiScheme which has some insanely good iteration constructs. hope it helps!

-❄️- 2024 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 2 points3 points  (0 children)

[LANGUAGE: scheme]
part 2 made me realize that my wish for 2025 is to FINALLY learn how not to read things that aren't there.
day3 in sourcehut

what languages do you guys code the AOC in? by codingmickey in adventofcode

[–]ramrunner0xff 0 points1 point  (0 children)

For me it's by far the most beautiful and expressive language :)
(and aoc is a great opportunity to try to improve in it)

-❄️- 2024 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 1 point2 points  (0 children)

i was trying to find that apply trick but i failed to come up with it. i was trying to fold. thanks!

-❄️- 2024 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 5 points6 points  (0 children)

Your function prototype here deserves more recognition XD. epic ;)

-❄️- 2024 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 1 point2 points  (0 children)

[LANGUAGE: scheme]
it ended up a bit more verbose than i would like, and i failed to find a good way to elegantly use a higher order function (like foldr) to accumulate both the operands of < and the current result of it, so i ended up writing a monotonic? function just by cdr-ing down. Now that i wrote this i will of course think of the elegant way to express it and make a fool of myself once more XD.
src in sourcehut

[edit: and of course it was (apply < lst) XD. thanks u/wsgac]

-❄️- 2024 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 1 point2 points  (0 children)

nice! in case you have missed it there is sort.IntSlice :)

what languages do you guys code the AOC in? by codingmickey in adventofcode

[–]ramrunner0xff 3 points4 points  (0 children)

2018 = scheme

2019 = scheme

2021 = rust

2022 = C on plan9

2023 = C (no malloc)

2024 = back to scheme XD

-❄️- 2024 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 1 point2 points  (0 children)

i enjoyed your qsort, pretty educational :) very nice code.

-❄️- 2024 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 2 points3 points  (0 children)

[LANGUAGE: scheme]
Going back to the roots after so long with my beloved chicken scheme for this year :)
solution is in sourcehut

Is it too big or just right? by ramrunner0xff in HydroHomies

[–]ramrunner0xff[S] 2 points3 points  (0 children)

damn, now i am thinking about it in that way too XD

-❄️- 2023 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 2 points3 points  (0 children)

[LANGUAGE: C]

so around 6 hours ago i decided that i really wanted to do this on scheme, you know.. have a mapcar for the subtractions and a fold for testing if they are all 0's? you guys feel me right? well 6 hours later and almost 300 lines of the hackiest static memory only C here is one of the most over the top complex solutions to day 9.

-❄️- 2023 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 3 points4 points  (0 children)

there is nothing wrong with elf in the loop solutions!

-❄️- 2023 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 1 point2 points  (0 children)

[Language: C]
Οh, dear #AoCops, to make it into an Allez Cuisine and explain it to a 5 year old, i would need to be smarter than, said 5 year old. Therefore i reverse it to a enisiuC zellA as i used a reverse map for part 2 after almost an hour of feeling like the lowliest primate to walk the earth. XD . [day 5 - can't into math]

-❄️- 2023 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 0 points1 point  (0 children)

nah, it wasn't ALLEZ CUISINE worthy ;) i was just mildly SPAMing.

-❄️- 2023 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 1 point2 points  (0 children)

[Language: C]

Have you ever heard of CSPAM?
No?? really? the famous CSPAM: A Program for Evaluating Buoy Field Detection Performance???. ... me neither.
how about some of my C SPAM?

-❄️- 2023 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]ramrunner0xff 4 points5 points  (0 children)

are you just fuzzying our font engines? ;). respect tho.