clojure quote symbols
Well, quote and its related symbols is too confusing for a clojure newbie.
Thanks to this excellent article.
', the single quote symbol near the
Enter button in your keyboard. Can turn off evaluation functionality for the following expression, its functionality is totally equivalent to
quote is simple and dedicate, which means the expression after this symbol will be treated just as literal, nothing more.
Let’s take some examples:
As you can see the
(eval) can evaluate the quoted or unevaluated(literal) expression and unveil its original ability.
This is a confusing symbol just because it looks like
'. But actually this symbol called
back-quote, located above the
Tab button in your keyboard.
Clojure call it
Very similar to
syntax-quote , will left expression behind it unevaluated, but it has some more functionalities.
syntax-quotewill try to find out the corresponding namespace of following symbols.
syntax-quotecould combine use with some other special characters such like
let us have some examples:
You may notice the
(quote) have identical name in clojure, called
You could use
' as short for
quote, but there have no short hand for
This is a magic symbol to unquote expression within the effect area of
syntax-quote, you could only use it in the scope of a
syntax-quote, it named
By unquoting, the expression affected by
~ now can be evaluated again even if it in domain of a
If you have seen my post of state management, you will know the
@ is about to derefer the
But here this symbol again have another behavior that is
@ symbol must combined use with
~, which finally becomes
It could extract the inner elementns from the quoted
5. let’s confusing
You will graduately get accustom to it.
syntax-quote will affect items one by one in it follow scope, while encounter
~ then temporary disabled
syntax-quote’s ability in this the scope of
Try to learn more by yourself.
You finally complete this article, what have you learnt about the
unquote symbol in clojure?