We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 964f33d commit f55f09eCopy full SHA for f55f09e
src/AOC2017/Day20.hs
@@ -8,6 +8,7 @@ import Control.Applicative (liftA2)
8
import Control.Monad (mfilter)
9
import Data.Char (isDigit)
10
import Data.Foldable (toList)
11
+import Data.List.Split (splitOn)
12
import qualified Data.Map as M
13
import qualified Data.Set as S
14
import qualified Data.Vector as V
@@ -51,11 +52,9 @@ parse = (\case L.V3 r v a -> S r v a)
51
52
. V.fromList . lines
53
54
parseLine :: String -> L.V3 (L.V3 Int)
-parseLine (mapread.words.onlyNums->[pX,pY,pZ,vX,vY,vZ,aX,aY,aZ])
55
+parseLine (map(read.filter numChar).splitOn","->[pX,pY,pZ,vX,vY,vZ,aX,aY,aZ])
56
= L.V3 (L.V3 pX pY pZ) (L.V3 vX vY vZ) (L.V3 aX aY aZ)
57
parseLine _ = error "No parse"
58
-onlyNums :: String -> String
59
-onlyNums = map $ \c -> if isDigit c || c == '-'
60
- then c
61
- else ' '
+numChar :: Char -> Bool
+numChar c = isDigit c || c == '-'
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments