Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
namespace FSharpTests
module Analytics =
open System
let getData (skuId: int) =
// fake data for now:
// a list of (date, value) observations
[ DateTime(2010, 1, 1), 10.;
DateTime(2010, 1, 2), 20.;
DateTime(2010, 1, 3), 30.;]
let predict (history: (DateTime * float) seq) =
// dumbest predictor that could work:
// pick latest observation (date,value),
// predict that value forever
let latest = history |> Seq.maxBy fst
snd latest
let predictForSku (skuId: int) =
let history = getData skuId
predict history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment