How can I add a second parameter to a macro in Clojure? -
I have the following closing rapping macro with 1 parameter:
(defmacro with- Init "check" wraps the details given with an init check. "[Body] '(if (initial?) ~ Body (throw (illegalstate exception." GOIP DB has not been started "))))
I want to add it to ip-version
so that I can check that just : IPv6
or : IPv4
Has been initialized. However, I do not pass the parameter:
(defmacro with-init-check "wraps the statement given with an init check." [Ip-version body] `(if (Initialized IP-version) ~ Body (throw (Invalid Stats Expression. "GOIP DB is not initial."))))
When I use it like this, "No such thing" "if-two [space ..." on line:
(defn-lookup-location "IP location information appears." [Ip ip-version] (With-init-check Ip-version (if-let) (Get location ip ip-version)] {ip: countrycode (.countryCode location): countryName (.countryName location): area (.region location): city (.city location): PostalCode (.postalCode location) : Latitude (.latitude location): Longitude (.longitude location): DMA-code (.dma_code location): Area-code (.area_code location): metro-code (.metro_code location)})))
< / Pre>How do I get
ip-version
frominitialized? function?
Contribute to ~
with:
(Dematrio-Init-Czech "wraps details given with an init check") [IP-version body] (if (started? ~ IP-version); to reduce your docstrings For, perhaps you want to allow multi-expression bodies and do not want to leave them () () them in a do
expression: (defmacro With-init-check "An Init Check "[IP-version and body] with multi-expression bodies and (if (initial? ~ IP-version) (~ @ body), ~ @ (throw away (invalidstate exposure." GOIP DB has not been started. "))))
Comments
Post a Comment