Taking advantage of a neat trick for using $ rather than a lambda master
authorNeil Smith <neil.git@njae.me.uk>
Mon, 29 Jan 2018 19:42:13 +0000 (19:42 +0000)
committerNeil Smith <neil.git@njae.me.uk>
Mon, 29 Jan 2018 19:42:13 +0000 (19:42 +0000)
src/advent21/advent21.hs

index fcc28d367e243f2911e82f17e631dc7a5a47faca..bd9ca0dfdf579b1ea9960e0593c701224574137e 100644 (file)
@@ -68,15 +68,16 @@ transposeG g = M.fromList [((c, r) , M.findWithDefault False (r, c) g) | r <- [0
 
 -- Find all the arrangments of a grid, including reflection and rotation.
 allArrangements :: Grid -> [Grid]
 
 -- Find all the arrangments of a grid, including reflection and rotation.
 allArrangements :: Grid -> [Grid]
-allArrangements grid = map (\f -> f grid) [ id
-                                          , reflectH
-                                          , reflectV
-                                          , transposeG
-                                          , reflectH . transposeG
-                                          , reflectV . transposeG
-                                          , reflectH . reflectV . transposeG
-                                          , reflectV . reflectH
-                                          ]
+-- allArrangements grid = map (\f -> f grid) [ id
+allArrangements grid = map ($ grid) [ id
+                                    , reflectH
+                                    , reflectV
+                                    , transposeG
+                                    , reflectH . transposeG
+                                    , reflectV . transposeG
+                                    , reflectH . reflectV . transposeG
+                                    , reflectV . reflectH
+                                    ]