;; Standard prelude
(defmac __chia__primitive__if (A B C)
(qq (a (i (unquote A) (com (unquote B)) (com (unquote C))) @))
)
(defun __chia__if (ARGS)
(__chia__primitive__if (r (r (r ARGS)))
(qq (a (i (unquote (f ARGS)) (com (unquote (f (r ARGS)))) (com (unquote (__chia__if (r (r ARGS)))))) @))
(qq (a (i (unquote (f ARGS)) (com (unquote (f (r ARGS)))) (com (unquote (f (r (r ARGS)))))) @))
)
)
(defmac if ARGS (__chia__if ARGS))
(defun __chia__compile-list (args)
(if args
(c 4 (c (f args) (c (__chia__compile-list (r args)) ())))
()
)
)
(defmac list ARGS (__chia__compile-list ARGS))
(defun-inline / (A B) (f (divmod A B)))
(defun __chia__sha256tree (t)
(a
(i
(l t)
(com (sha256 2 (__chia__sha256tree (f t)) (__chia__sha256tree (r t))))
(com (sha256 1 t))
)
@
)
)