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

34 lines
812 B
Clojure
Raw Normal View History

(meditations
2013-02-26 02:46:19 +00:00
"We shall contemplate truth by testing reality, via equality"
2010-07-26 23:20:42 +00:00
(= __ true)
2013-02-26 02:46:19 +00:00
"To understand reality, we must compare our expectations against reality"
2010-07-26 23:20:42 +00:00
(= __ (+ 1 1))
2010-07-26 23:20:42 +00:00
"You can test equality of many things"
2013-03-04 22:45:55 +00:00
(= (+ 3 4) 7 (+ 2 __))
2010-10-29 15:18:09 +00:00
"Some things may appear different, but be the same"
2013-03-04 22:45:55 +00:00
(= __ (= 2 2/1))
2010-10-29 15:18:09 +00:00
"You cannot generally float to heavens of integers"
(= __ (= 2 2.0))
"But a looser equality is also possible"
2013-03-04 22:45:55 +00:00
(= __ (== 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"
(= __ (not (= 1 nil)))
2013-03-04 23:30:00 +00:00
"Strings, and keywords, and symbols: oh my!"
(= __ (= "foo" :foo 'foo))
"Make a keyword with your keyboard"
(= :foo (keyword __))
"Symbolism is all around us"
(= 'foo (symbol __))
2010-11-04 13:01:34 +00:00
"When things cannot be equal, they must be different"
(not= :fill-in-the-blank __))