Day 4: put renames in extra line

This commit is contained in:
Christoph Stahl 2021-12-04 17:37:02 +01:00
parent 355609ae28
commit fd70c7b371

View file

@ -1,11 +1,5 @@
import Data.Either import Data.Either
m=map
e=[]:e e=[]:e
r=pure
l=Left
c=isLeft
z=zipWith
i=isRight
a=m.m.m.k a=m.m.m.k
h=any$all i h=any$all i
a?b|c a,i b=b|let=l 0 a?b|c a,i b=b|let=l 0
@ -16,5 +10,6 @@ v[]=[];v s=tail(take 6 s):v(drop 6 s)
s(v:t)|'.'>v=[]:s t|(x:u)<-s t=(v:x):u s(v:t)|'.'>v=[]:s t|(x:u)<-s t=(v:x):u
p(x:y)=(m read$s x,v$m(m(l.read).words)y) p(x:y)=(m read$s x,v$m(m(l.read).words)y)
q i=(\(b,h:_)->z(?)(last b)h)$span(any c)i q i=(\(b,h:_)->z(?)(last b)h)$span(any c)i
m=map;r=pure;l=Left;c=isLeft;z=zipWith;i=isRight
main=interact$show.((,).w q<*>w(filter i=<<)).p.lines main=interact$show.((,).w q<*>w(filter i=<<)).p.lines
x!d|h d||h(foldr(z(:))e d)=r$(x*)$sum$lefts=<<d|let=l 0 x!d|h d||h(foldr(z(:))e d)=r$(x*)$sum$lefts=<<d|let=l 0