about summary refs log tree commit diff
path: root/day02.ijs
blob: 3faeed7a1683a221717d6632e65426aab63fdbe7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
load 'aoc.ijs'
d =: lines 'day02'

part1=: 3 : 0
'a b c d' =. chopstring '- ' stringreplace y
(-: /:~) (".a),(+/d={.c),(".b)
)

+/ part1@> d    NB. 586

part2=: 3 : 0
'a b c d' =. chopstring '- ' stringreplace y
1=+/ ((<: (". a),(".b)) { d) = {.c
)

+/ part2@> d    NB. 352