Created
December 12, 2015 17:23
-
-
Save msszczep/7f713a7bbdd75220313e to your computer and use it in GitHub Desktop.
Coffee in Java and Clojure
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
// https://www.facebook.com/WondersofEngineering/photos/a.255298751271223.61509.255293124605119/701667366634357/?type=3&theater | |
Coffee coffee = new Coffee(); | |
if (coffee.Empty) { | |
coffee.Refill(); | |
} else { | |
coffee.Drink(); | |
} | |
;; I can rewrite it in Clojure in two lines: | |
(let [c Coffee.] | |
(if (empty? c) (.Refill c) (.Drink c))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment