We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a009ae3 commit 439d1c2Copy full SHA for 439d1c2
solutions/src/2024/21.hs
@@ -1,4 +1,4 @@
1
-{-# Language BlockArguments, ImportQualifiedPost #-}
+{-# Language BlockArguments, LambdaCase, ImportQualifiedPost #-}
2
{-|
3
Module : Main
4
Description : Day 21 solution
@@ -80,9 +80,9 @@ shortRobotCode ::
80
Int {- ^ robot layers -} ->
81
String {- ^ robot arrows code -} ->
82
Int {- ^ shortest button press count -}
83
-shortRobotCode = memo2 \n ->
84
- if n == 0 then length else
85
- sum . map (minimum . map (shortRobotCode (n - 1))) . route robotPad
+shortRobotCode = memo2 \case
+ 0 -> length
+ n -> sum . map (minimum . map (shortRobotCode (n - 1))) . route robotPad
86
87
-- | Find a list of steps needed to input a code on a pad. The inner
88
-- lists allow for there to be multiple, valid subsequences that exist
0 commit comments