flan/web/examples/compare.flan

12 lines
466 B
Plaintext

;; The arithmetic operators and the comparisons both take a run of operands.
;; The orderings chain: each neighbouring pair is compared, and every pair has
;; to hold. != is the one that does not chain — it asks whether the operands
;; are all distinct, so a value repeated anywhere in the run makes it false.
(defn main [] ()
(println (+ 1 2 3 4))
(println (< 1 2 3))
(println (< 1 3 2))
(println (= 4 4 4))
(println (!= 1 2 3))
(println (!= 1 2 1)))