Last active
September 7, 2021 12:22
-
-
Save PEZ/ef5021f621afad511d1a4b5505fc231f to your computer and use it in GitHub Desktop.
Logical falsity and truth – Rich 4Clojure Problem 162 – See: https://github.com/PEZ/rich4clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns rich4clojure.elementary.problem-162 | |
(:require [hyperfiddle.rcf :refer [tests]])) | |
;; = Logical falsity and truth = | |
;; By 4Clojure user: hangkous | |
;; Difficulty: Elementary | |
;; Tags: [logic] | |
;; | |
;; In Clojure, only nil and false represent the values of | |
;; logical falsity in conditional tests - anything else is | |
;; logical truth. | |
(def __ :tests-will-fail) | |
(comment | |
) | |
(tests | |
__ := (if-not false 1 0) | |
__ := (if-not nil 1 0) | |
__ := (if true 1 0) | |
__ := (if [] 1 0) | |
__ := (if [0] 1 0) | |
__ := (if 0 1 0) | |
__ := (if 1 1 0)) | |
;; To participate, fork: | |
;; https://github.com/PEZ/rich4clojure | |
;; Post your solution below, please! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1