From 9323c1285a8a9f7ec33e88d26f102d92c7a6e2ec Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Sun, 10 Oct 2021 14:15:45 +0200 Subject: Add cond special form --- examples/booleans.bdl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'examples/booleans.bdl') diff --git a/examples/booleans.bdl b/examples/booleans.bdl index d526f25..24d57a0 100644 --- a/examples/booleans.bdl +++ b/examples/booleans.bdl @@ -54,3 +54,24 @@ (print "(if (or (+ 1 2 3) false) (+ 1 2 3) (+ 7 8 9)) -> ") (if (or (+ 1 2 3) false) (+ 1 2 3) (+ 7 8 9)) (print "(if true 7) -> ") (if true 7) (print "(if false 7) -> ") (if false 7) + +;; Cond. +(print "(cond ((and true true true) 1) ((or true true false) 2) (else 3)) -> ") +(cond ((and true true true) 1) + ((or true true false) 2) + (else 3)) +(print "(cond ((and true true false) 1) ((or true true false) 2) (else 3)) -> ") +(cond ((and true true false) 1) + ((or true true false) 2) + (else 3)) +(print "(cond ((and true true false) 1) ((or false false false) 2) (else 3)) -> ") +(cond ((and true true false) 1) + ((or false false false) 2) + (else 3)) +(print "(cond ((and true true true) 1) ((or true true false) 2)) -> ") +(cond ((and true true false) 1) + ((or false false false) 2)) +(print "(cond ((and true true true) (+ 1 2 3)) ((or true true false) 2) (else 3)) -> ") +(cond ((and true true true) (+ 1 2 3)) + ((or true true false) 2) + (else 3)) -- cgit v1.2.1