Skip to content

Instantly share code, notes, and snippets.

@haiiro-shimeji
Last active December 10, 2015 18:08
Show Gist options
  • Save haiiro-shimeji/4471941 to your computer and use it in GitHub Desktop.
Save haiiro-shimeji/4471941 to your computer and use it in GitHub Desktop.
時系列データ型
module Data (
TimeSeries(..)
) where
data TimeSeries a = TimeSeries {
delta :: a
, dataArray :: [a]
} deriving (Show)
computeDerivative :: (Floating a) => TimeSeries a -> TimeSeries a
computeDerivative s =
let make' [] = []
make' (d0:[]) = []
make' (d0:d1:da) = ((d1 - d0)/(delta s)) : make' (d1:da)
in TimeSeries (delta s) $ make' (dataArray s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment