Files
RustAst/examples/soa_series.myc
T
Michael Schimmel 46b546446f Add RecordSeries::get_record and support for (my_ticks 0)
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`.
2026-03-01 18:44:46 +01:00

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))
)