Skip to content

Instantly share code, notes, and snippets.

@bhyde
Last active December 26, 2016 23:03
Show Gist options
  • Save bhyde/5850920 to your computer and use it in GitHub Desktop.
Save bhyde/5850920 to your computer and use it in GitHub Desktop.
Named-Readtables, and example.
;;;; Load some utilities
;;; ... typically this would go in our ASDF system file.
;;; in which case you wouldn't need the eval when
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload "cl-interpol")
(ql:quickload "named-readtables"))
;;;; Define a package and a read table.
;;; ... typically this would go in your packages.lisp
;;; in which case you wouldn't need the eval when
(defpackage #:test (:use #:common-lisp))
(eval-when (:compile-toplevel :load-toplevel :execute)
(unless (named-readtables:find-readtable :cl-interpol)
(named-readtables:defreadtable :cl-interpol
(:merge :current)
(:dispatch-macro-char #\# #\? #'interpol::interpol-reader))))
;;;; Now enjoy them them.
;;; ... the remainder is an example source
(in-package #:test)
(named-readtables:in-readtable :cl-interpol)
(defun foo ()
#?[This is package is: ${(package-name *package*)}.])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment