1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
;; conditional
(@if a (@then a is true) (@else a is false))
(@if b (@then b is true) (@else b is false))
(@if a (@then a is true))
(@if b (@then b is true))
;; nested conditionals
(@if a (@then (@if b (@then a and b are true) (@else a is true and b is false)))
(@else (@if b (@then a is false and b is true) (@else a and b are false))))
;; not
(@if (not a) (@then a is false))
(@if (not b) (@then b is false))
;; and
(@if (and) (@then true))
(@if (and a) (@then a is true))
(@if (and b) (@then b is true))
(@if (and a b) (@then a and b are true))
(@if (and a (not b)) (@then a is true and b is false))
(@if (and (not a) b) (@then a is false and b is true))
(@if (and (not a) (not b)) (@then a and b are false))
;; or
(@if (or) (@then false))
(@if (or a) (@then a is true))
(@if (or b) (@then b is true))
(@if (or a b) (@then a or b is true))
(@if (or a (not b)) (@then a is true or b is false))
(@if (or (not a) b) (@then a is false or b is true))
(@if (or (not a) (not b)) (@then a or b is false))
;; strings
(@if (= "\n" "\0a") (@then newline))
(@if (= "\'" "'") (@then quote))
;; string comparisons
(@if (= c "1") (@then c is 1))
(@if (= c "2") (@then c is 2))
(@if (<> c "1") (@then c is not 1))
(@if (<> c "2") (@then c is not 2))
;; version comparisons
(@if (= (4 1 1) (4 1 0)) (@then (4 1 1) = (4 1 0)))
(@if (= (4 1 1) (4 1 1)) (@then (4 1 1) = (4 1 1)))
(@if (= (4 1 1) (4 1 2)) (@then (4 1 1) = (4 1 2)))
(@if (<> (4 1 1) (4 1 0)) (@then (4 1 1) <> (4 1 0)))
(@if (<> (4 1 1) (4 1 1)) (@then (4 1 1) <> (4 1 1)))
(@if (<> (4 1 1) (4 1 2)) (@then (4 1 1) <> (4 1 2)))
(@if (<= (4 1 1) (4 1 0)) (@then (4 1 1) <= (4 1 0)))
(@if (<= (4 1 1) (4 1 1)) (@then (4 1 1) <= (4 1 1)))
(@if (<= (4 1 1) (4 1 2)) (@then (4 1 1) <= (4 1 2)))
(@if (>= (4 1 1) (4 1 0)) (@then (4 1 1) >= (4 1 0)))
(@if (>= (4 1 1) (4 1 1)) (@then (4 1 1) >= (4 1 1)))
(@if (>= (4 1 1) (4 1 2)) (@then (4 1 1) >= (4 1 2)))
(@if (> (4 1 1) (4 1 0)) (@then (4 1 1) > (4 1 0)))
(@if (> (4 1 1) (4 1 1)) (@then (4 1 1) > (4 1 1)))
(@if (> (4 1 1) (4 1 2)) (@then (4 1 1) > (4 1 2)))
;; version comparisons: lexicographic order
(@if (< (4 1 1) (4 1 0)) (@then (4 1 1) < (4 1 0)))
(@if (< (4 1 1) (4 1 1)) (@then (4 1 1) < (4 1 1)))
(@if (< (4 1 1) (4 1 2)) (@then (4 1 1) < (4 1 2)))
(@if (< (4 1 1) (4 0 2)) (@then (4 1 1) < (4 0 2)))
(@if (< (4 1 1) (4 2 0)) (@then (4 1 1) < (4 2 0)))
(@if (< (4 1 1) (5 0 1)) (@then (4 1 1) < (5 0 1)))
(@if (< (4 1 1) (3 2 1)) (@then (4 1 1) < (3 2 1)))
;; strings
(@string $s "abcd")
(@string "abcd")
(@string "\\\'\28\n")
(@if (and) (@then (@string "abcd")))
(@if (or) (@then) (@else (@string "abcd")))
;; chars
(@string "0")
(@string "\n")
|