Last active
December 26, 2016 23:03
-
-
Save bhyde/5850920 to your computer and use it in GitHub Desktop.
Named-Readtables, and example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; 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