46b546446f
This commit introduces the `get_record` method to `RecordSeries`, allowing for the dynamic reconstruction of a full record from its constituent fields at a given index. This enables idiomatic access to series data using indexing like `(my_ticks 0)`. The `push-series` function has also been updated to correctly handle the structure of records when pushing data into a `RecordSeries`.
16 lines
422 B
Plaintext
16 lines
422 B
Plaintext
;; Output: 26.7
|
|
;; Benchmark: 998ns
|
|
;; Benchmark-Repeat: 2047
|
|
(do
|
|
(def template {:price 10.0 :volume 100 :msg "hi"})
|
|
(def my_ticks (create-series template))
|
|
|
|
(push-series my_ticks {:price 10.5 :volume 100 :msg "A"})
|
|
(push-series my_ticks {:price 11.2 :volume 200 :msg "B"})
|
|
(push-series my_ticks {:price 15.5 :volume 300 :msg "C"})
|
|
|
|
(def prices (.price my_ticks))
|
|
|
|
(+ (prices 0) (prices 1))
|
|
)
|