Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@daviddpark
Created February 1, 2013 18:26
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 daviddpark/4693104 to your computer and use it in GitHub Desktop.
Save daviddpark/4693104 to your computer and use it in GitHub Desktop.
;; Here is the function definition I am trying to use, from
;; https://github.com/ptaoussanis/carmine/blob/master/src/taoensso/carmine.clj:
(defn make-conn-spec
[& {:keys [host port password timeout db]
:or {host "127.0.0.1" port 6379 password nil timeout 0 db 0}}]
{:host host :port port :password password :timeout timeout :db db})
;; I have read about destructuring both in clojure.org special forms
;; and in the Joy of Clojure book, but I can't wrap my head around
;; how to invoke this function.
;;I have tried invoking this function to get something other than the default return value of:
{:host "127.0.0.1" :port 6379 :password nil :timeout 0 :db 0}
;; ...to no avail. I have tried passing in a map:
(make-conn-spec {:host "example.com" :port 9999 :password "insecure" :timeout 900 :db 1})
;; I have tried passing in arguments:
(make-conn-spec "example.com" 9999 "insecure" 900 1)
;; I have tried a ridiculous map:
(make-conn-spec {"host" "example.com" "port" 9999 "password" "insecure" "timeout" 900 "db" 1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment