how to programatically check for reader macros

旧城冷巷雨未停 提交于 2019-12-25 04:14:16

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/15520076/how-to-programatically-check-for-reader-macros

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!