fa23a4c125
The `Parameter` kind in `UntypedKind` was only used for identifiers that were being declared or referenced. This commit renames it to `Identifier` and updates all the necessary code to reflect this change. This simplifies the AST and makes it more consistent. Additionally, a new macro `repeat` has been added to `src/ast/system.myc`.
31 lines
629 B
Plaintext
31 lines
629 B
Plaintext
;; 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
|
|
)
|
|
)
|
|
)
|