(in-package :cl-user) (defparameter *repl-readtable* (copy-readtable nil)) (defparameter *standard-readtable* (copy-readtable nil)) (defpackage repl-commands (:use)) (defun read-command (s) (let ((*package* (find-package "REPL-COMMANDS"))) (read s t nil t))) (defun command-reader (s c) (let ((*readtable* *standard-readtable*)) (funcall (read-command s)))) (defun standard-reader (s c) (let ((*readtable* *standard-readtable*)) (unread-char c s) (read s t nil t))) (set-macro-character #\: #'command-reader t *repl-readtable*) (set-macro-character #\( #'standard-reader nil *repl-readtable*) (set-macro-character #\' #'standard-reader nil *repl-readtable*) (defun repl-commands::display () (print *)) ;; In REPL (setf *readtable* *repl-readtable*)