OK, ~@ is one operator, I thought it was two different operators.
Thank you. Le mercredi 20 mai 2015 18:38:50 UTC-4, Laurens Van Houtven a écrit : > > Hi Pierre, > > > On May 20, 2015, at 3:35 PM, Pierre Thibault <pierre.t...@gmail.com > <javascript:>> wrote: > > Is possible to use the operator '@' alone? In the Joy Of Clojure book it > is presented as '~@'. I would like an example. > > > There are multiple contexts in which @ could be used. One is syntactic > sugar for the deref function; @x is just (deref x), where x is some > reference type like an atom. > > ~@, unquote-splice, is an entirely different beast. It is used inside > syntax-quote (a backtick, `) in macros to mean “take all of these forms and > put them into this form”, e.g.: > > (let [xs ‘(1 2 3 4)] > `(+ ~@xs)) > > turns into: > > (+ 1 2 3 4) > > … so the difference between it and just ~ is the “splicing”; regular > unquote (~) would get you: > > (+ [1 2 3 4]) > > > hth > lvh > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clo...@googlegroups.com <javascript:> > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+u...@googlegroups.com <javascript:> > 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+u...@googlegroups.com <javascript:>. > 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.