ql-goheecus

CL-RTTEMPLATE

The cl-rttemplate is a read-time quotation system. Published in the public domain. It’s a template system similar to the quasiquote & unquote facility, however, it operates during the read-time.

I’ve created this for a need to macroize the commonqt reader macros.

Download

The asdf-installable package: cl-rttemplate.tar.gz

API

Usage

Enable the syntax by (cl-rttemplate:enable-syntax) or (rtt:enable-syntax).

Modify the readtable at your will; for example: (setf (readtable-case rtt:*rt*) :preserve).

Samples

Simple symbol building:

#"'begin"(expt 3 8)"end"#

You can use the lexical bindings:

(let ((lexical-value '|Hello|))
  #"'(a b " lexical-value " \"" lexical-value " world!\")"#)

and now change the readtable-case:

(setf (readtable-case rtt:*rt*) :preserve)
(let ((lexical-value '|Hello|))
  #"'(a b " lexical-value " \"" lexical-value " world!\")"#)

A splicing example:

#"'(a " #@'(a b c) " e)"#

and another one:

#"(* " #0@(floor 100 7) " " #1@(floor 25 13) ")"#