2cf48566f7
The `sma.myc` file, which defined the Simple Moving Average macro, has been removed. This functionality is no longer needed.
34 lines
721 B
Plaintext
34 lines
721 B
Plaintext
;; Myc System Library
|
|
;; Standard macros and core utilities.
|
|
|
|
(do
|
|
(def func1 (print "Hello World"))
|
|
|
|
(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.
|
|
;; The element type is inferred from the stream's item type.
|
|
(macro cache [lookback src]
|
|
`(do
|
|
(def data (series ~lookback))
|
|
(pipe [~src] (fn [s] (do (push data s))))
|
|
data
|
|
)
|
|
)
|
|
)
|