Skip to content

Instantly share code, notes, and snippets.

@PEZ
Last active September 7, 2021 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PEZ/ef5021f621afad511d1a4b5505fc231f to your computer and use it in GitHub Desktop.
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
(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!
@evedes
Copy link

evedes commented Sep 7, 2021

1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment