diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-12-08 15:13:54 +0100 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-12-08 15:13:54 +0100 |
commit | 3f63cb8a2d53fd33ce800ca6944a92af0c6b1b24 (patch) | |
tree | e1c8a211a2918a26512e1af77b10be07a3079d73 /day8.k | |
parent | 6f07fc5e07bcbdcf78f15066761d3e00d166579f (diff) | |
download | adventofcode2015-3f63cb8a2d53fd33ce800ca6944a92af0c6b1b24.tar.gz adventofcode2015-3f63cb8a2d53fd33ce800ca6944a92af0c6b1b24.tar.xz adventofcode2015-3f63cb8a2d53fd33ce800ca6944a92af0c6b1b24.zip |
day8
Diffstat (limited to 'day8.k')
-rw-r--r-- | day8.k | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/day8.k b/day8.k new file mode 100644 index 0000000..cf89ef4 --- /dev/null +++ b/day8.k @@ -0,0 +1,19 @@ +/ use k-3.2 + +d:0:"day8" + +ll: +/#:'d / literal length + +ue:{ + s:_ssr[x;"\\\\";"z"] + s:_ssr[s;"\\\"";"z"] + :(#s)-2+3*+/"\\"=s +} + +ml: +/ue'd / unencoded length + +ll-ml + +el: {2+(#x)+#&("\""=x)|("\\"=x)} / encoded length + +(+/el' d)-ll |