Last active
August 29, 2015 14:04
-
-
Save teddziuba/71c545f0a93f6e7131eb to your computer and use it in GitHub Desktop.
data transport by function definitions?
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
;; We define a product record as a series of explicitly-defined function return values. | |
;; - This only convey data, not execution | |
;; - It can reference itself in a sensible way | |
;; - Consumers aren't concerned about message formatting, simply whether or not | |
;; a given function is defined. | |
(defpoints SKU12345 | |
(defpoint com.example.seller [this] | |
{:email "[email protected]" | |
:name "Example Merchant Inc."}) | |
(defpoint com.ebay.item.title [country] "Apple iPad") | |
(defpoint com.ebay.item.shipping-policy [:com.ebay.countries.germany] | |
{:processing-days 3 | |
:shipping-type :expedited | |
:shipping-cost 0}) | |
(defpoint com.ebay.item.shipping-policy [:com.ebay.countries.uk] | |
{:processing-days 3 | |
:shipping-type :standard | |
:shipping-cost 10}) | |
(defpoint com.ebay.item.paypal-email [country] (-> this com.example.seller :email))) | |
;; (com.ebay.title :com.ebay.countries.germany SKU12345) --> "Apple iPad" | |
;; (com.ebay.title :com.ebay.countries.uk SKU12345) --> "Apple iPad" | |
;; (com.ebay.title :com.ebay.countries.japan SKU12345) --> "Apple iPad" | |
;; | |
;; (com.ebay.item.shipping-policy SKU12345 :com.ebay.countries.uk) --> | |
;; {:processing-days 3 | |
;; :shipping-type :standard | |
;; :shipping-cost 10} | |
;; | |
;; (com.ebay.item.seller-email SKU12345) --> "[email protected]" | |
;; | |
;; (com.ebay.item.return-policy SKU12345) --> ERROR, undefined function point. | |
;; OR could use some default value here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment