Refactor series implementation into its own module
This commit reorganizes the series-related code by moving the `RingBuffer`, `ScalarSeries`, `ValueSeries`, `RecordSeries`, `SeriesView`, and `SharedSeries` structs into a new `src/ast/rtl/series/data.rs` file. The `src/ast/rtl/series/mod.rs` file now contains the module declaration, re-exports, and the `register` function for registering series-related native functions with the environment. This improves code organization and maintainability.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
;; Myc System Library
|
||||
;; Standard macros and core utilities.
|
||||
|
||||
(do
|
||||
(macro while [cond body]
|
||||
`((fn [] (if ~cond
|
||||
(do ~body (again))
|
||||
)))
|
||||
)
|
||||
|
||||
(macro repeat [var limit body]
|
||||
`((fn [~var __limit]
|
||||
(if (< ~var __limit)
|
||||
(do
|
||||
~body
|
||||
(again (+ ~var 1) __limit)
|
||||
)
|
||||
))
|
||||
0 ~limit)
|
||||
)
|
||||
|
||||
;; Creates a stateful cache (Series) from a stateless stream.
|
||||
(macro cache [lookback type src]
|
||||
`(do
|
||||
(def data (series ~lookback ~type))
|
||||
(pipe [~src] (fn [s] (do (push data s))))
|
||||
data
|
||||
)
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user