aoc2017-0.1.0.0: Advent of Code 2017 - my answers

Safe HaskellSafe
LanguageHaskell2010

Day16

Description

 

Synopsis

Documentation

data Move i e Source #

A dance move.

Constructors

Spin i 
Exchange i i 
Partner e e 

words' :: String -> [String] Source #

Split words by whitespaces or commas.

parse :: String -> [Move Int Char] Source #

Parse a list of dance moves.

(-*-) :: (IArray a e, IArray a' i, Ix i) => a i e -> a' i i -> a i e infixl 7 Source #

Compose two permutations.

(-^-) :: (IArray a i, Ix i) => a i i -> Int -> a i i infixr 8 Source #

Repeat a permutation.

exchange :: Eq a => a -> a -> a -> a Source #

Like id, but swapping the two given values.

permuteNames :: IArray a Char => Int -> [Move i Char] -> a Char Char Source #

Given a list of dance moves, map out the resulting partner changes.

permuteIndices :: IArray a Int => Int -> [Move Int e] -> a Int Int Source #

Given a list of dance moves, map out the resulting spins and exchanges.