common-lisp - 如何禁用阅读器宏?
问题描述
我使用本地时间的阅读器宏,直到我意识到我不需要它(想读回日期?只需使用格式或本地时间:格式日期字符串,它不会输出@
...)。
但是,它与使用 Parenscript 代码冲突ps:@
冒号后的非法终止字符:#@
我可以在不重新启动图像的情况下禁用阅读器宏吗?
它的作用是
(defun enable-read-macros ()
"Enables the local-time reader macros for literal timestamps and universal time."
(set-macro-character #\@ '%read-timestring)
(set-dispatch-macro-character #\# #\@ '%read-universal-time)
(values))
我没有在 Parenscript 方面看到阅读器宏。
解决方案
也许您可以做的是尝试使用类似这样的方法将更改还原到当前可读表,这应该会获得标准可读表并将当前可读表的条目“恢复”为标准表。
(let ((rt (copy-readtable nil)))
(multiple-value-bind (function non-terminating-p)
(get-macro-character #\@ rt)
(set-macro-character #\@ function non-terminating-p))
(set-dispatch-macro-character #\# #\@ (get-dispatch-macro-character #\# #\@ rt)))
推荐阅读
- list - 来自未来
- > 列出
用于在常规函数/脚手架中使用的 API 调用 - php - 使用 jQuery 和 PHP 处理表单验证错误,PHP 未加载
- javascript - 用 C/C++ 编写的设备固件可以使用 SignalR 从 Web 服务器接收推送通知吗?
- c++ - 我在动态分配的数组中丢失了元素
- c - 已经审查了几个答案,但仍然没有在 C 中获得权力
- r - R - 如何根据某个日期和字符串对所有值求和?
- javascript - 在不重新加载页面的情况下无法获得正确的输入值
- ios - CallKit 可以检测 GSM 呼叫并检索来电号码吗?
- scrapy - First Scraper > INFO:已抓取 0 页(以 0 页/分钟),抓取 0 项(以 0 项/分钟)
- spring-mvc - spring mvc 4:使用属性格式注释将字符串解析为 java.time.LocalDate