From a804cd7bdf6cf1557cca4656eeca678925059358 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 3 Dec 2020 15:25:35 +0100 Subject: day02 --- day02.ijs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 day02.ijs (limited to 'day02.ijs') diff --git a/day02.ijs b/day02.ijs new file mode 100644 index 0000000..3faeed7 --- /dev/null +++ b/day02.ijs @@ -0,0 +1,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 -- cgit 1.4.1