2017-05-12 17:17:43 -04:00
|
|
|
package seq
|
2017-04-30 00:12:39 -04:00
|
|
|
|
2017-04-30 02:17:28 -04:00
|
|
|
// NewArray creates a new array.
|
|
|
|
func NewArray(values ...float64) Array {
|
|
|
|
return Array(values)
|
|
|
|
}
|
|
|
|
|
2017-04-30 00:12:39 -04:00
|
|
|
// Array is a wrapper for an array of floats that implements `ValuesProvider`.
|
|
|
|
type Array []float64
|
|
|
|
|
|
|
|
// Len returns the value provider length.
|
|
|
|
func (a Array) Len() int {
|
|
|
|
return len(a)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetValue returns the value at a given index.
|
|
|
|
func (a Array) GetValue(index int) float64 {
|
|
|
|
return a[index]
|
|
|
|
}
|