diff options
-rw-r--r-- | day3.k | 9 | ||||
-rw-r--r-- | day5.k | 3 |
2 files changed, 5 insertions, 7 deletions
diff --git a/day3.k b/day3.k index f4e8791..92812cc 100644 --- a/day3.k +++ b/day3.k @@ -1,10 +1,9 @@ d: *0:"day3"; / with case z:{:[x=">";1 0;x="<";-1 0;x="^";0 1;x="v";0 -1; 0 0]}'d; z: (1 0;-1 0;0 1;0 -1) @ "<>^v"?/:d; -u: {x@*:'=x}; -r: u@ +\ (, 0 0) , z; -#r +r: +\ (, 0 0) , z; +#?r z2: + -1 2 # z; / alternating split -r2: u@ ,/ +\' (,0 0) ,/: z2; -#r2 +r2: ,/ +\' (,0 0) ,/: z2; +#?r2 diff --git a/day5.k b/day5.k index 938d43c..09fef93 100644 --- a/day5.k +++ b/day5.k @@ -7,9 +7,8 @@ r3: {~#,/x _ss ("ab";"cd";"pq";"xy")}; / no ab/cd/pq/xy #&(r3'd)&(r2'd)&(r1'd) bg: {[s]{x;2#(x-1) _ s}'1+!#s}; / bigrams -u: {x@*:'=x}; / uniq -r4: {0<#&1<#:' x _ss u@bg x}; / duplicate bigram +r4: {0<#&1<#:' x _ss ?bg x}; / duplicate bigram r5: {0<#&(-2_ x)=(2_ x)}; / matches (.).\1 #&(r4'd)&(r5'd) |