Day eight: Tuple sections :3
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE TupleSections #-}
|
||||||
module Common where
|
module Common where
|
||||||
|
|
||||||
import Data.Foldable (toList)
|
import Data.Foldable (toList)
|
||||||
@@ -11,7 +12,7 @@ pairPermutations :: [a] -> [(a, a)]
|
|||||||
pairPermutations [] = []
|
pairPermutations [] = []
|
||||||
pairPermutations [_] = []
|
pairPermutations [_] = []
|
||||||
pairPermutations [x, y] = pure (x, y)
|
pairPermutations [x, y] = pure (x, y)
|
||||||
pairPermutations (x:xs) = map (\y -> (x, y)) xs ++ pairPermutations xs
|
pairPermutations (x:xs) = map (x,) xs ++ pairPermutations xs
|
||||||
|
|
||||||
type Position = (Int, Int)
|
type Position = (Int, Int)
|
||||||
type Antenna = (Char, Position)
|
type Antenna = (Char, Position)
|
||||||
|
|||||||
Reference in New Issue
Block a user