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

40 lines
977 B
Clojure
Raw Normal View History

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