I will be doing AoC this year in a bunch of unusual languages. I will select the language for each day and try to avoid reusing languages. I am also allowed to use Racket (my language of choice) to do preprocessing/parsing and as a harness for some of the challenge languages. For example, 2023 day 2 is a perfect fit for TIS-100 if the input is provided in a better format. This allowance will hopefully lead to more interesting and varied solutions.
This restriction is part of a mutual challenge with jesskai to get her to learn Racket. I am also playing in a betting pool which will be distributed proportional to local leaderboard score, so I’m pretty extrinsically motivated to stick with it this year.
I don’t really get uiua but part 1 was pretty straightforward. I tried to do part 2 in it as well but couldn’t figure out how to operate on one array element-wise but not the other.
[solution for part 1]
# prepend input here as [left array] [right array]
⍆⊙⍆
/+⌵-
[solution for part 2]
I did this in google sheets because I don’t have excel but it should be similar.
=COUNTIF(B:B,A1)
.=A1*D1
.=SUM(E:E)
.Pending
a11ce: hey can i use perl today bc it’s The Regex Language
a11ce: i’ve actually never touched it before
jesskai: no but you can use ruby
jesskai: haha get it pokemon
Ruby is a pretty nice language, it feels like alternate-universe python in a good way. I have no idea if putting things in classes is correct I just copied some example boilerplate.
Do you wish Racket had fewer parentheses? Do you want to use a stack language without the whole ‘thinking about the stack’ thing? Stacket is the language for you!
In Stacket, functions are implicitly grouped with their arguments using known arity or annotations. For example, it interprets (cons 1 list.3 2 3 *.2 2 2)
as (cons 1 (list 2 3 (* 2 2)))
. It’s really not that bad to write in; it’s not like you think about nesting explicitly anyway.
I think a Racket-based language like this could have potential for code golf with further development.
Link to code
Link to Stacket implementation (pretty hacky, consider this an open alpha. PRs welcome.)