owa-rs/modules/core/cmp.owa
2026-05-06 12:21:06 +03:00

25 lines
No EOL
537 B
Text

(seq
(defmacro eq? <Bool>[]
(if-eq ($%%) :true :false))
(defmacro nq? <Bool>[]
(if-eq ($%%) :false :true))
(fn cmp <Keyword>[left right]
(match (builtins.cmp left right)
(-1 :less)
(0 :equal)
(1 :greater)))
(fn lt? <Bool>[left right]
(eq? (cmp left right) :less))
(fn lte? <Bool>[left right]
(bool.or (lt? left right) (eq? left right)))
(fn gt? <Bool>[left right]
(eq? (cmp left right) :greater))
(fn gte? <Bool>[left right]
(bool.or (gt? left right) (eq? left right)))
)