aoc2017-0.1.0.0: Advent of Code 2017 - my answers

Safe HaskellSafe
LanguageHaskell2010

Day20

Description

 

Synopsis

Documentation

data Vec3 a Source #

A 3D vector.

Constructors

Vec3 

Fields

  • x :: !a
     
  • y :: !a
     
  • z :: !a
     

data Point a Source #

A point with position, velocity, and acceleration in 3D space.

Constructors

Point 

Fields

readMany :: Read a => String -> [a] Source #

Read non-overlapping substrings.

parse :: Read a => String -> [Point a] Source #

Reads points.

(*+*) :: Num a => Vec3 a -> Vec3 a -> Vec3 a infixl 3 Source #

Pointwise addition.

(*-*) :: Num a => Vec3 a -> Vec3 a -> Vec3 a infixl 3 Source #

Pointwise subtraction.

step :: Num a => Point a -> Point a Source #

Performs one timestep of velocity and position updates.

manhattan :: Num a => Vec3 a -> a Source #

Returns the Manhattan distance of a vector to the origin.

signumsMatch :: (Eq a, Num a) => Point a -> Bool Source #

Returns true if repeated step will not change the sign of any component of velocity and position.

collide :: Ord a => (b -> a) -> [b] -> [b] Source #

Filters out all elements which are duplicated under transformation.