package sentio import ( "cmp" "slices" ) func CompareProbabilityStamps(a, b *Probability_Stamp) int { return cmp.Compare(a.Time.AsTime().Unix(), b.Time.AsTime().Unix()) } func (x *Probability) First() (*Probability_Stamp, bool) { return x.Next(0) } func (x *Probability) Next(n int) (*Probability_Stamp, bool) { if x.Stamps == nil || len(x.Stamps) <= n { return nil, false } slices.SortFunc(x.Stamps, CompareProbabilityStamps) return x.Stamps[n], true }