Skip to content

Instantly share code, notes, and snippets.

@tomphp
Last active August 29, 2015 14:07
Show Gist options
  • Save tomphp/7cebee49783f8f13a314 to your computer and use it in GitHub Desktop.
Save tomphp/7cebee49783f8f13a314 to your computer and use it in GitHub Desktop.
Clojure Value Objects
// 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