Lisps use read/eval, quote/syntax-quote, unquote/unquote-splicing and so on to make writing macros possible.
Does Mathematica has any operators like these?
I know there is a topic on HoldAll, Unevaluated, Hold, HoldFirst, HoldRest, NHoldAll, HoldAllComplete, SequenceHold, Inactivate, Extract.
And Mathematica itself implemented lazy-eval, so that symbolic computation works.
Are there any operators who works as unquote-splicing? And are there any other operators do the same kind of things?
For example:
Racket has unquote-splicing:
(quasiquote (0 (unquote-splicing (list 1 2)) 4))
;; => '(0 1 2 4)
and ~@ is unquote-splicing in Clojure:
`(1 2 ~@(list 3 4))
;; => (1 2 3 4)
Thanks!
Are there any operators who works as unquote-splicing?but you have not explained whatunquote-splicingis, or given a link to what it is. Since most folks here probably are not lisp programmers, it helps to explain what thisunquote-splicingdoes. – Nasser Feb 23 '17 at 06:41Sequence?{1, 2, Sequence@@{3, 4}, 5}=>{1, 2, 3, 4, 5}– Feb 23 '17 at 08:27Hold,Sequence,Unevaluated,Inactivate,Defer, etc.) than the Chapter 22 macro facility. – m_goldberg Feb 23 '17 at 08:35Sequenceall you need, or are you looking for "real"unquote-splicingi.e. something that will work in context of code quoting. – jkuczm Feb 27 '17 at 13:22