Last active
August 29, 2015 14:07
-
-
Save tomphp/7cebee49783f8f13a314 to your computer and use it in GitHub Desktop.
Clojure Value Objects
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
// Given | |
(defn make-customer [name email] | |
{:name name, :email email}) | |
// Examples | |
(def customer1 (make-customer "Tom" "email@address.com")) | |
// vs... | |
(defn make-name [name] name) | |
(defn make-email [email] email) | |
(def customer2 | |
(make-customer (make-name "Tom") | |
(make-email "email@address.com"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment