Skip to content

Instantly share code, notes, and snippets.

@msszczep
Created December 12, 2015 17:23
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 msszczep/7f713a7bbdd75220313e to your computer and use it in GitHub Desktop.
Save msszczep/7f713a7bbdd75220313e to your computer and use it in GitHub Desktop.
Coffee in Java and Clojure
// 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