1.18 Quote

The KC3 Quote type allows you for code quotes that holds evaluation by one level. The quote can be made a partial quote using unquote making the evaluation more eager by one level.

Quoting is necessary for meta-programming where you want to return a quoted value that will not be evaluated except the quote will be removed. Unquote produces the inverse, re-enabling evaluation of macro arguments inside a quote for instance.

Unquote takes parenthesis while quote does not. Quoting with parenthesis will return you a Call to the paren operator. Do not do that. Unquote can only be called inside a quote.

1.18.1 Examples

ikc3> quote 1 + 1
1 + 1
ikc3> quote quote 1 + 1
quote 1 + 1
ikc3> type(quote 1 + 1)
Call
ikc3> type(quote quote 1 + 1)
Quote

Examples with unquote

ikc3> m = macro (x) { quote 1 + unquote x }
macro(x) { quote 1 + unquote(x) }
ikc3> m(41)
42

Top : KC3 documentation

Previous : 1.17 Ptr

Next : 1.19 Ratio