Last active
January 1, 2016 20:59
-
-
Save swannodette/8200979 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(ns example) | |
(defrecord HTTPRequest [type url proxy]) | |
(HTTPRequest/getBasis) | |
;; => | |
;; [type url proxy] | |
(defrecord HTTPProxy [host port]) | |
(map->HTTPRequest | |
{:type :get | |
:url "http://example.org" | |
:proxy (HTTPProxy. "foo" 11111)}) | |
;; => | |
;; #example.HTTPRequest{ | |
;; :type :get, | |
;; :url "http://example.org", | |
;; :proxy #example.HTTPProxy{:host "foo", :port 11111} | |
;; } | |
(:proxy | |
(map->HTTPRequest | |
{:type :get | |
:url "http://example.org" | |
:proxy (HTTPProxy. "foo" 11111)})) | |
;; => | |
;; #example.HTTPProxy{:host "foo", :port 11111} | |
(keys | |
(map->HTTPRequest | |
{:type :get | |
:url "http://example.org" | |
:proxy (HTTPProxy. "foo" 11111)})) | |
;; => | |
;; (:type :url :proxy) | |
((juxt :url :proxy) | |
(map->HTTPRequest | |
{:type :get | |
:url "http://example.org" | |
:proxy (HTTPProxy. "foo" 11111)})) | |
;; => | |
;; ["http://example.org" #example.HTTPProxy{:host "foo", :port 11111}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment