You can only safely assume that the first symbol (defn) is a macro, it turns out 'destructure' is a function called by the macro (which might call other functions/macros that call other functions/macros :-).
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4233 On Wed, May 13, 2015 at 7:43 PM <piastkra...@gmail.com> wrote: > Maybe I should have already known this, but I am struck by this, and I'd > like to confirm it. If I'm working with this code: > > > > https://github.com/drewr/postal/blob/389162cafab08224e50bd6721cac93fe14ca3257/src/postal/support.clj > > > and if, at the REPL, I do this: > > > user=> (require '[postal.support :refer :all]) > > > user=> (clojure.walk/macroexpand-all '(defn make-props [sender {:keys > [host port user tls]}] > > #_=> (doto (Properties.) > > #_=> (.put "mail.smtp.host" (or host "not.provided")) > > #_=> (.put "mail.smtp.port" (or port "25")) > > #_=> (.put "mail.smtp.auth" (if user "true" "false")) > > #_=> (do-when sender (.put "mail.smtp.from" sender)) > > #_=> (do-when user (.put "mail.smtp.user" user)) > > #_=> (do-when tls (.put "mail.smtp.starttls.enable" "true"))))) > > (def make-props > > (fn* > > ([sender p__1201] > > (let* [map__1202 p__1201 > > map__1202 (if (clojure.core/seq? map__1202) > > (. clojure.lang.PersistentHashMap create (clojure.core/seq map__1202)) > > map__1202) > > tls (clojure.core/get map__1202 :tls) > > user (clojure.core/get map__1202 :user) > > port (clojure.core/get map__1202 :port) > > host (clojure.core/get map__1202 :host)] > > (let* [G__1203 (new Properties)] > > (. G__1203 put "mail.smtp.host" > > (let* [or__3943__auto__ host] > > (if or__3943__auto__ > > or__3943__auto__ > > "not.provided"))) > > (. G__1203 put "mail.smtp.port" > > (let* [or__3943__auto__ port] > > (if or__3943__auto__ > > or__3943__auto__ > > "25"))) > > (. G__1203 put "mail.smtp.auth" (if user "true" "false")) > > (if sender > > (do (let* [G__1204 G__1203] (. G__1204 put "mail.smtp.from" sender) > G__1204))) > > (if user > > (do (let* [G__1205 G__1203] (. G__1205 put "mail.smtp.user" user) > G__1205))) > > (if tls > > (do (let* [G__1206 G__1203] (. G__1206 put "mail.smtp.starttls.enable" > "true") G__1206))) > > G__1203))))) > > > > I see this: > > > defn make-props [sender {:keys [host port user tls]}] > > > re-written as: > > > (fn* > > ([sender p__1201] > > (let* [map__1202 p__1201 > > map__1202 (if (clojure.core/seq? map__1202) > > (. clojure.lang.PersistentHashMap create (clojure.core/seq map__1202)) > > map__1202) > > tls (clojure.core/get map__1202 :tls) > > user (clojure.core/get map__1202 :user) > > port (clojure.core/get map__1202 :port) > > host (clojure.core/get map__1202 :host)] > > > So, if the destructuring is re-written by macroexpand, then I can > reasonably assume that destructuring is implemented as a macro, yes? > > > > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.