Deux v0.1.3 Deux.DataPoints View Source

List abstraction to store with a max limit

Link to this section Summary

Functions

It adds a value to a data_points if the length is below the max limit, otherwise it will discard the last value and add the new one

Discard the last value from the values list

Link to this section Functions

It adds a value to a data_points if the length is below the max limit, otherwise it will discard the last value and add the new one

Examples

iex> points = %Deux.DataPoints{limit: 3, values: [1,2,3]} iex> Deux.DataPoints.add(points, 4) %Deux.DataPoints{limit: 3, values: [4,1,2]}

Link to this function

discard_last(data_points)

View Source

Discard the last value from the values list

Examples

iex> Deux.DataPoints.discard_last(%Deux.DataPoints{values: [1,2,3]})
%Deux.DataPoints{values: [1,2], limit: 2_000}