From 998dadcce8d53c644150c387f939b4a11d3a6fe9 Mon Sep 17 00:00:00 2001 From: Christoph Stahl Date: Wed, 8 Dec 2021 17:25:59 +0100 Subject: [PATCH] Day 8: 358 --- d8golf.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d8golf.hs b/d8golf.hs index de135ff..32633c0 100644 --- a/d8golf.hs +++ b/d8golf.hs @@ -1,4 +1,4 @@ import Data.List r(p,o)=map(\h->last(h:[p|h==o])) -main=interact$show.((,).sum.map(foldl1$(+).(10*))<*>length.filter(`elem`[1,4,7,8]).concat).map(drop 10.t.filter(/="|").words).lines +main=interact$show.((,).sum.map(foldl1$(+).(10*))<*>length.filter(`elem`[1,4,7,8]).concat).map(drop 10.t.filter(<"|").words).lines t z=head[p|q<-permutations['a'..'g'],Just p<-[mapM((`elemIndex`["012345","12","01346","01236","1256","02356","023456","012","0123456","012356"]).sort.($zip['0'..]q).foldr r)z]]