如何编程检查读取器宏 [英] how to programatically check for reader macros
问题描述
我有一个可以包含任意数据的向量。我想检查任何元素是一个读者宏,我该如何做?
(is-reader-macro? ; DateTime 2012>); => true
一旦字符串读取
,你不能通过结果数据来确定读取器结构是创建它。您刚刚读取的数据项不是阅读器宏,而只是数据。
在您的具体示例中,您所获得的是jodatime DateTime对象的打印表示,其不能被读取 - #< ...>
构造是为了防止这种情况。打印的实际对象只是一个jodatime DateTime对象,而不是阅读器宏。
I have a vector which can contain arbitrary data. I want to check of any of the element is a reader macro, how do I do that ?
(is-reader-macro? #<DateTime 2012>) ;=> true
Thanks, Murtaza
Once a string is read
you cannot tell by the resulting data what the exact reader construct was that created it. The data item you just read is not a reader macro, it's just data.
In your specific example, what you've got is the printed representation of a jodatime DateTime object, which cannot be read - the #< ... >
construct is meant to prevent that. The actual object that prints like that is just a jodatime DateTime object, not a reader macro.
这篇关于如何编程检查读取器宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!