clojure-koans/src/koans/01_equalities.clj

39 lines
945 B
Clojure
Raw Normal View History

(ns koans.01-equalities
(:require [koan-engine.core :refer :all]))
(meditations
2020-03-05 19:00:12 +00:00
"We shall contemplate truth by testing reality, via equality"
(= true true)
2020-03-05 19:00:12 +00:00
"To understand reality, we must compare our expectations against reality"
2020-03-05 19:00:12 +00:00
(= 2 (+ 1 1))
"You can test equality of many things"
(= (+ 3 4) 7 (+ 2 5))
2010-10-29 15:18:09 +00:00
2020-03-05 19:00:12 +00:00
"Some things may appear different, but be the same"
(= true (= 2 2/1))
2010-10-29 15:18:09 +00:00
2020-03-05 19:00:12 +00:00
"You cannot generally float to heavens of integers"
(= false (= 2 2.0))
2010-10-29 15:18:09 +00:00
2020-03-05 19:00:12 +00:00
"But a looser equality is also possible"
(= true (== 2.0 2))
2010-11-04 13:01:34 +00:00
2020-03-05 19:00:12 +00:00
"Something is not equal to nothing"
(= true (not (= 1 nil)))
2013-03-04 23:06:46 +00:00
2020-03-05 19:00:12 +00:00
"Strings, and keywords, and symbols: oh my!"
(= false (= "hello" :hello 'hello))
2013-03-04 23:30:00 +00:00
2020-03-05 19:00:12 +00:00
"Make a keyword with your keyboard"
(= :hello (keyword "hello"))
2013-03-04 23:30:00 +00:00
2020-03-05 19:00:12 +00:00
"Symbolism is all around us"
(= 'hello (symbol 'hello))
2013-03-04 23:30:00 +00:00
2020-03-05 19:00:12 +00:00
"What could be equivalent to nothing?"
(= nil nil)
2020-03-05 19:00:12 +00:00
"When things cannot be equal, they must be different"
(not= :fill-in-the-blank nil))