diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-12-07 22:44:30 +0100 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-12-07 22:44:30 +0100 |
commit | 6f07fc5e07bcbdcf78f15066761d3e00d166579f (patch) | |
tree | 8817d28c5f28d8688958ce8914b8deec7a844c9a | |
parent | 1ba60f272d94629dfa1219b11464596f295e5d67 (diff) | |
download | adventofcode2015-6f07fc5e07bcbdcf78f15066761d3e00d166579f.tar.gz adventofcode2015-6f07fc5e07bcbdcf78f15066761d3e00d166579f.tar.xz adventofcode2015-6f07fc5e07bcbdcf78f15066761d3e00d166579f.zip |
day6: use apply
-rw-r--r-- | day6.k | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/day6.k b/day6.k index 6f95738..fbc112e 100644 --- a/day6.k +++ b/day6.k @@ -8,9 +8,9 @@ l:ss[;" "]' d; f:1000 1000 # 0; -on: {f[rg[x[0];x[2]];rg[x[1];x[3]]]:1}; -off: {f[rg[x[0];x[2]];rg[x[1];x[3]]]:0}; -toggle:{f[rg[x[0];x[2]];rg[x[1];x[3]]]~:}; +on: {f[rg . x 0 2; rg . x 1 3]:1}; +off: {f[rg . x 0 2; rg . x 1 3]:0}; +toggle:{f[rg . x 0 2; rg . x 1 3]~:}; op:{ :["on"~x[1];on[,/ds'x[2 4]] @@ -26,10 +26,10 @@ op' l; f:1000 1000 # 0; -on: {f[rg[x[0];x[2]];rg[x[1];x[3]]]+:1}; -off: {f[rg[x[0];x[2]];rg[x[1];x[3]]]-:1 - f[rg[x[0];x[2]];rg[x[1];x[3]]]|:0}; -toggle:{f[rg[x[0];x[2]];rg[x[1];x[3]]]+:2}; +on: {f[rg . x 0 2; rg . x 1 3]+:1}; +off: {f[rg . x 0 2; rg . x 1 3]-:1 + f[rg . x 0 2; rg . x 1 3]|:0}; +toggle:{f[rg . x 0 2; rg . x 1 3]+:2}; op' l; |