Skip to content

Instantly share code, notes, and snippets.

@meooow25
meooow25 / 01.ijs
Last active December 10, 2022 11:10
Advent of Code 2022, learning J
splitlines2 =: (LF, LF) & strsplit
splitlines =: LF & cut
parsemany =: ". each
part1 =: >./ @: > @: ((+/ @: > @: parsemany @: splitlines) each) @: splitlines2
ans1 =: part1 readaoc 1
part2 =: +/ @: (3 & {.) @: \:~ @: > @: ((+/ @: > @: parsemany @: splitlines) each) @: splitlines2
ans2 =: part2 readaoc 1